feat: Pin invited rooms

Invitations should always be on top of the
room list. This makes it an optional parameter now which defaults to
true.
This commit is contained in:
Christian Pauly 2021-09-01 14:00:22 +02:00 committed by Krille Fear
parent efb5842959
commit d921f38734
2 changed files with 7 additions and 1 deletions

View File

@ -160,6 +160,7 @@ class Client extends MatrixApi {
this.importantStateEvents,
this.roomPreviewLastEvents,
this.pinUnreadRooms = false,
this.pinInvitedRooms = true,
this.sendMessageTimeoutSeconds = 60,
this.requestHistoryOnLimitedTimeline = false,
this.supportedLoginTypes,
@ -1576,6 +1577,9 @@ sort order of ${prevState.sortOrder}. This should never happen...''');
/// If `true` then unread rooms are pinned at the top of the room list.
bool pinUnreadRooms;
/// If `true` then unread rooms are pinned at the top of the room list.
bool pinInvitedRooms;
/// The compare function how the rooms should be sorted internally. By default
/// rooms are sorted by timestamp of the last m.room.message event or the last
/// event if there is no known message.

View File

@ -545,7 +545,9 @@ class Room {
}
/// Returns true if this room has a m.favourite tag.
bool get isFavourite => tags[TagType.favourite] != null;
bool get isFavourite =>
tags[TagType.favourite] != null ||
(client.pinInvitedRooms && membership == Membership.invite);
/// Sets the m.favourite tag for this room.
Future<void> setFavourite(bool favourite) =>