implemented #63 : non kick leave msgs

This commit is contained in:
unknown 2021-08-18 14:05:10 +05:30
parent c23be53bfd
commit 78c4c67a6c

View file

@ -12,11 +12,13 @@ function getTimelineJSXMessages() {
</> </>
); );
}, },
leave(user) { leave(user, reason) {
const reasonMsg = (typeof reason === 'string') ? `: ${reason}` : '';
return ( return (
<> <>
<b>{user}</b> <b>{user}</b>
{' left the channel'} {' left the channel'}
{reasonMsg}
</> </>
); );
}, },
@ -48,7 +50,7 @@ function getTimelineJSXMessages() {
); );
}, },
kick(actor, user, reason) { kick(actor, user, reason) {
const reasonMsg = (typeof reason === 'string') ? ` for ${reason}` : ''; const reasonMsg = (typeof reason === 'string') ? `: ${reason}` : '';
return ( return (
<> <>
<b>{actor}</b> <b>{actor}</b>
@ -59,7 +61,7 @@ function getTimelineJSXMessages() {
); );
}, },
ban(actor, user, reason) { ban(actor, user, reason) {
const reasonMsg = (typeof reason === 'string') ? ` for ${reason}` : ''; const reasonMsg = (typeof reason === 'string') ? `: ${reason}` : '';
return ( return (
<> <>
<b>{actor}</b> <b>{actor}</b>
@ -209,7 +211,7 @@ function parseTimelineChange(mEvent) {
if (sender === mEvent.getStateKey()) { if (sender === mEvent.getStateKey()) {
switch (prevContent.membership) { switch (prevContent.membership) {
case 'invite': return makeReturnObj('invite-cancel', tJSXMsgs.rejectInvite(senderName)); case 'invite': return makeReturnObj('invite-cancel', tJSXMsgs.rejectInvite(senderName));
default: return makeReturnObj('leave', tJSXMsgs.leave(senderName)); default: return makeReturnObj('leave', tJSXMsgs.leave(senderName, content.reason));
} }
} }
switch (prevContent.membership) { switch (prevContent.membership) {