display m.room.history_visibility updates in the timeline

pull/21833/head
Matthew Hodgson 2016-03-15 23:47:40 +00:00
parent 5f68f1313b
commit 0e1186c4f9
3 changed files with 27 additions and 3 deletions

View File

@ -151,6 +151,28 @@ function textForThreePidInviteEvent(event) {
" to join the room.";
};
function textForHistoryVisibilityEvent(event) {
var senderName = event.sender ? event.sender.name : event.getSender();
var vis = event.getContent().history_visibility;
var text = senderName + " made future room history visible to ";
if (vis === "invited") {
text += "all room members, from the point they are invited.";
}
else if (vis === "joined") {
text += "all room members, from the point they joined.";
}
else if (vis === "shared") {
text += "all room members.";
}
else if (vis === "world_readable") {
text += "anyone.";
}
else {
text += " unknown (" + vis + ")";
}
return text;
};
var handlers = {
'm.room.message': textForMessageEvent,
'm.room.name': textForRoomNameEvent,
@ -159,7 +181,8 @@ var handlers = {
'm.call.invite': textForCallInviteEvent,
'm.call.answer': textForCallAnswerEvent,
'm.call.hangup': textForCallHangupEvent,
'm.room.third_party_invite': textForThreePidInviteEvent
'm.room.third_party_invite': textForThreePidInviteEvent,
'm.room.history_visibility': textForHistoryVisibilityEvent,
};
module.exports = {

View File

@ -44,7 +44,8 @@ var eventTileTypes = {
'm.call.hangup' : 'messages.TextualEvent',
'm.room.name' : 'messages.TextualEvent',
'm.room.topic' : 'messages.TextualEvent',
'm.room.third_party_invite': 'messages.TextualEvent'
'm.room.third_party_invite' : 'messages.TextualEvent',
'm.room.history_visibility' : 'messages.TextualEvent',
};
var MAX_READ_AVATARS = 5;

View File

@ -450,7 +450,7 @@ module.exports = React.createClass({
<input type="radio" id="hvis_sh" name="historyVis" value="shared"
defaultChecked={historyVisibility === "shared"}
onChange={this._onHistoryRadioToggle} />
Members only (since the room began)
Members only (since the point in time of selecting this option)
</label>
<label htmlFor="hvis_inv">
<input type="radio" id="hvis_inv" name="historyVis" value="invited"