mirror of
https://github.com/element-hq/element-web
synced 2024-11-26 11:15:53 +03:00
Add kick message. Add reasons if given.
This commit is contained in:
parent
c8caf34777
commit
006907e52f
1 changed files with 11 additions and 2 deletions
|
@ -33,20 +33,29 @@ module.exports = React.createClass({
|
|||
// XXX: SYJS-16
|
||||
var senderName = ev.sender ? ev.sender.name : "Someone";
|
||||
var targetName = ev.target ? ev.target.name : "Someone";
|
||||
var reason = ev.getContent().reason ? (
|
||||
" Reason: " + ev.getContent().reason
|
||||
) : "";
|
||||
switch (ev.getContent().membership) {
|
||||
case 'invite':
|
||||
return senderName + " invited " + targetName + ".";
|
||||
case 'ban':
|
||||
return senderName + " banned " + targetName + ".";
|
||||
return senderName + " banned " + targetName + "." + reason;
|
||||
case 'join':
|
||||
return targetName + " joined the room.";
|
||||
case 'leave':
|
||||
if (ev.getSender() === ev.getStateKey()) {
|
||||
return targetName + " left the room.";
|
||||
}
|
||||
else {
|
||||
else if (ev.getPrevContent().membership === "ban") {
|
||||
return senderName + " unbanned " + targetName + ".";
|
||||
}
|
||||
else if (ev.getPrevContent().membership === "join") {
|
||||
return senderName + " kicked " + targetName + "." + reason;
|
||||
}
|
||||
else {
|
||||
return targetName + " left the room.";
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue