fix: updated membership-leave for archived direct chats
This commit is contained in:
parent
77561ced07
commit
9b9e311010
|
|
@ -290,20 +290,12 @@ class Room {
|
|||
.calcDisplayname(i18n: i18n);
|
||||
if (sender != null) return sender;
|
||||
}
|
||||
if (isArchived) {
|
||||
// In case of a direct chat, we need to get the room-members via the RoomMember event-type
|
||||
// then we have to make sure to get the other room-member that is not us, to add them to the display name.
|
||||
final roomMemberEvents = states.entries
|
||||
.firstWhereOrNull((element) => element.key == EventTypes.RoomMember);
|
||||
final otherRoomMember = roomMemberEvents?.value.entries
|
||||
.firstWhereOrNull((entry) => entry.value.senderId != client.userID);
|
||||
|
||||
if (otherRoomMember?.value.prevContent?.tryGet('displayname') != null) {
|
||||
return i18n.wasDirectChatDisplayName(
|
||||
otherRoomMember!.value.prevContent!.tryGet('displayname')!);
|
||||
}
|
||||
}
|
||||
if (membership == Membership.leave) {
|
||||
if (directChatMatrixID != null) {
|
||||
return i18n.wasDirectChatDisplayName(
|
||||
unsafeGetUserFromMemoryOrFallback(directChatMatrixID)
|
||||
.calcDisplayname(i18n: i18n));
|
||||
}
|
||||
final invitation = getState(EventTypes.RoomMember, client.userID!);
|
||||
if (invitation != null &&
|
||||
invitation.unsigned?.tryGet<String>('prev_sender') != null) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue