mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Avoid empty membership events
This commit is contained in:
parent
5078bdd14f
commit
6f0260d59f
1 changed files with 6 additions and 9 deletions
|
@ -2088,19 +2088,16 @@ TimelineModel::formatMemberEvent(const QString &id)
|
|||
}
|
||||
break;
|
||||
case Membership::Leave:
|
||||
if (!prevEvent) // Should only ever happen temporarily
|
||||
return {};
|
||||
|
||||
if (prevEvent->content.membership == Membership::Invite) {
|
||||
if (event->state_key == event->sender)
|
||||
rendered = tr("%1 rejected their invite.").arg(name);
|
||||
else
|
||||
rendered = tr("%2 revoked the invite to %1.").arg(name, senderName);
|
||||
} else if (prevEvent->content.membership == Membership::Join) {
|
||||
if (!prevEvent || prevEvent->content.membership == Membership::Join) {
|
||||
if (event->state_key == event->sender)
|
||||
rendered = tr("%1 left the room.").arg(name);
|
||||
else
|
||||
rendered = tr("%2 kicked %1.").arg(name, senderName);
|
||||
} else if (prevEvent->content.membership == Membership::Invite) {
|
||||
if (event->state_key == event->sender)
|
||||
rendered = tr("%1 rejected their invite.").arg(name);
|
||||
else
|
||||
rendered = tr("%2 revoked the invite to %1.").arg(name, senderName);
|
||||
} else if (prevEvent->content.membership == Membership::Ban) {
|
||||
rendered = tr("%2 unbanned %1.").arg(name, senderName);
|
||||
} else if (prevEvent->content.membership == Membership::Knock) {
|
||||
|
|
Loading…
Reference in a new issue