1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-06-26 04:01:04 +03:00

display m.room.history_visibility updates in the timeline

This commit is contained in:
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 = {