mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-24 13:09:24 +01:00
Merge branch 'krille/fix-pinned-events' into 'main'
chore: Follow up fix pinned event ids See merge request famedly/fluffychat!741
This commit is contained in:
commit
df8420a17f
@ -886,18 +886,16 @@ class ChatController extends State<Chat> {
|
|||||||
if (room == null) return;
|
if (room == null) return;
|
||||||
final pinnedEventIds = room.pinnedEventIds;
|
final pinnedEventIds = room.pinnedEventIds;
|
||||||
final selectedEventIds = selectedEvents.map((e) => e.eventId).toSet();
|
final selectedEventIds = selectedEvents.map((e) => e.eventId).toSet();
|
||||||
final pin = selectedEventIds.any((e) => !pinnedEventIds.contains(e));
|
final unpin = selectedEventIds.length == 1 &&
|
||||||
|
pinnedEventIds.contains(selectedEventIds.single);
|
||||||
|
if (unpin) {
|
||||||
|
pinnedEventIds.removeWhere(selectedEventIds.contains);
|
||||||
|
} else {
|
||||||
|
pinnedEventIds.addAll(selectedEventIds);
|
||||||
|
}
|
||||||
showFutureLoadingDialog(
|
showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => room.setPinnedEvents(
|
future: () => room.setPinnedEvents(pinnedEventIds),
|
||||||
pin
|
|
||||||
? <String>{
|
|
||||||
...pinnedEventIds,
|
|
||||||
...selectedEvents.map((e) => e.eventId),
|
|
||||||
}.toList()
|
|
||||||
: pinnedEventIds
|
|
||||||
..removeWhere(selectedEventIds.contains),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user