mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-23 20:49:26 +01:00
chore: Follow up pinned events allow unpin via appbar button
This commit is contained in:
parent
e023d52bef
commit
edb3adf208
@ -883,13 +883,21 @@ class ChatController extends State<Chat> {
|
||||
}
|
||||
|
||||
void pinEvent() {
|
||||
final room = this.room;
|
||||
if (room == null) return;
|
||||
final pinnedEventIds = room.pinnedEventIds;
|
||||
final selectedEventIds = selectedEvents.map((e) => e.eventId).toSet();
|
||||
final pin = selectedEventIds.any((e) => !pinnedEventIds.contains(e));
|
||||
showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => room!.setPinnedEvents(
|
||||
<String>{
|
||||
...room!.pinnedEventIds,
|
||||
...selectedEvents.map((e) => e.eventId),
|
||||
}.toList(),
|
||||
future: () => room.setPinnedEvents(
|
||||
pin
|
||||
? <String>{
|
||||
...pinnedEventIds,
|
||||
...selectedEvents.map((e) => e.eventId),
|
||||
}.toList()
|
||||
: pinnedEventIds
|
||||
..removeWhere(selectedEventIds.contains),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user