feat: Implement threads

This commit is contained in:
krille-chan 2025-11-04 21:08:45 +01:00
commit 380625327a
No known key found for this signature in database
7 changed files with 166 additions and 21 deletions

View file

@ -5,9 +5,21 @@ import 'package:fluffychat/config/setting_keys.dart';
extension VisibleInGuiExtension on List<Event> {
List<Event> filterByVisibleInGui({
String? exceptionEventId,
String? threadId,
}) =>
where(
(event) => event.isVisibleInGui || event.eventId == exceptionEventId,
(event) {
if (threadId != null) {
if ((event.relationshipType != RelationshipTypes.thread ||
event.relationshipEventId != threadId) &&
event.eventId != threadId) {
return false;
}
} else if (event.relationshipType == RelationshipTypes.thread) {
return false;
}
return event.isVisibleInGui || event.eventId == exceptionEventId;
},
).toList();
}