mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Add kick message. Add reasons if given.
This commit is contained in:
parent
c8caf34777
commit
006907e52f
@ -33,20 +33,29 @@ module.exports = React.createClass({
|
|||||||
// XXX: SYJS-16
|
// XXX: SYJS-16
|
||||||
var senderName = ev.sender ? ev.sender.name : "Someone";
|
var senderName = ev.sender ? ev.sender.name : "Someone";
|
||||||
var targetName = ev.target ? ev.target.name : "Someone";
|
var targetName = ev.target ? ev.target.name : "Someone";
|
||||||
|
var reason = ev.getContent().reason ? (
|
||||||
|
" Reason: " + ev.getContent().reason
|
||||||
|
) : "";
|
||||||
switch (ev.getContent().membership) {
|
switch (ev.getContent().membership) {
|
||||||
case 'invite':
|
case 'invite':
|
||||||
return senderName + " invited " + targetName + ".";
|
return senderName + " invited " + targetName + ".";
|
||||||
case 'ban':
|
case 'ban':
|
||||||
return senderName + " banned " + targetName + ".";
|
return senderName + " banned " + targetName + "." + reason;
|
||||||
case 'join':
|
case 'join':
|
||||||
return targetName + " joined the room.";
|
return targetName + " joined the room.";
|
||||||
case 'leave':
|
case 'leave':
|
||||||
if (ev.getSender() === ev.getStateKey()) {
|
if (ev.getSender() === ev.getStateKey()) {
|
||||||
return targetName + " left the room.";
|
return targetName + " left the room.";
|
||||||
}
|
}
|
||||||
else {
|
else if (ev.getPrevContent().membership === "ban") {
|
||||||
return senderName + " unbanned " + targetName + ".";
|
return senderName + " unbanned " + targetName + ".";
|
||||||
}
|
}
|
||||||
|
else if (ev.getPrevContent().membership === "join") {
|
||||||
|
return senderName + " kicked " + targetName + "." + reason;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return targetName + " left the room.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user