mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 14:59:29 +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() {
|
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(
|
showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => room!.setPinnedEvents(
|
future: () => room.setPinnedEvents(
|
||||||
<String>{
|
pin
|
||||||
...room!.pinnedEventIds,
|
? <String>{
|
||||||
|
...pinnedEventIds,
|
||||||
...selectedEvents.map((e) => e.eventId),
|
...selectedEvents.map((e) => e.eventId),
|
||||||
}.toList(),
|
}.toList()
|
||||||
|
: pinnedEventIds
|
||||||
|
..removeWhere(selectedEventIds.contains),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user