Merge pull request #3198 from matrix-org/t3chguy/kick
Show anything other than ban/invite -> leave as a kick
This commit is contained in:
commit
56b1775209
3 changed files with 13 additions and 7 deletions
|
@ -100,15 +100,14 @@ function textForMemberEvent(ev) {
|
||||||
}
|
}
|
||||||
} else if (prevContent.membership === "ban") {
|
} else if (prevContent.membership === "ban") {
|
||||||
return _t('%(senderName)s unbanned %(targetName)s.', {senderName, targetName});
|
return _t('%(senderName)s unbanned %(targetName)s.', {senderName, targetName});
|
||||||
} else if (prevContent.membership === "join") {
|
|
||||||
return _t('%(senderName)s kicked %(targetName)s.', {senderName, targetName}) + ' ' + reason;
|
|
||||||
} else if (prevContent.membership === "invite") {
|
} else if (prevContent.membership === "invite") {
|
||||||
return _t('%(senderName)s withdrew %(targetName)s\'s invitation.', {
|
return _t('%(senderName)s withdrew %(targetName)s\'s invitation.', {
|
||||||
senderName,
|
senderName,
|
||||||
targetName,
|
targetName,
|
||||||
}) + ' ' + reason;
|
}) + ' ' + reason;
|
||||||
} else {
|
} else {
|
||||||
return _t('%(targetName)s left the room.', {targetName});
|
// sender is not target and made the target leave, if not from invite/ban then this is a kick
|
||||||
|
return _t('%(senderName)s kicked %(targetName)s.', {senderName, targetName}) + ' ' + reason;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -345,8 +345,8 @@ module.exports = React.createClass({
|
||||||
switch (e.mxEvent.getPrevContent().membership) {
|
switch (e.mxEvent.getPrevContent().membership) {
|
||||||
case 'invite': return 'invite_withdrawal';
|
case 'invite': return 'invite_withdrawal';
|
||||||
case 'ban': return 'unbanned';
|
case 'ban': return 'unbanned';
|
||||||
case 'join': return 'kicked';
|
// sender is not target and made the target leave, if not from invite/ban then this is a kick
|
||||||
default: return 'left';
|
default: return 'kicked';
|
||||||
}
|
}
|
||||||
default: return null;
|
default: return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -494,7 +494,14 @@ describe('MemberEventListSummary', function() {
|
||||||
membership: "leave",
|
membership: "leave",
|
||||||
senderId: "@some_other_user:some.domain",
|
senderId: "@some_other_user:some.domain",
|
||||||
},
|
},
|
||||||
// default = left
|
// default for sender=target (leave)
|
||||||
|
{
|
||||||
|
userId: "@user_1:some.domain",
|
||||||
|
prevMembership: "????",
|
||||||
|
membership: "leave",
|
||||||
|
senderId: "@user_1:some.domain",
|
||||||
|
},
|
||||||
|
// default for sender<>target (kicked)
|
||||||
{
|
{
|
||||||
userId: "@user_1:some.domain",
|
userId: "@user_1:some.domain",
|
||||||
prevMembership: "????",
|
prevMembership: "????",
|
||||||
|
@ -520,7 +527,7 @@ describe('MemberEventListSummary', function() {
|
||||||
|
|
||||||
expect(summaryText).toBe(
|
expect(summaryText).toBe(
|
||||||
"user_1 was invited, was banned, joined, rejected their invitation, left, " +
|
"user_1 was invited, was banned, joined, rejected their invitation, left, " +
|
||||||
"had their invitation withdrawn, was unbanned, was kicked and left",
|
"had their invitation withdrawn, was unbanned, was kicked, left and was kicked",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue