feat: Implement polls

This commit is contained in:
Christian Kußowski 2025-11-02 13:10:55 +01:00
commit 71fa853f05
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
12 changed files with 582 additions and 63 deletions

View file

@ -16,8 +16,8 @@ extension IsStateExtension on Event {
// always filter out edit and reaction relationships
!{RelationshipTypes.edit, RelationshipTypes.reaction}
.contains(relationshipType) &&
// always filter out m.key.* events
!type.startsWith('m.key.verification.') &&
// always filter out m.key.* and other known but unimportant events
!isKnownHiddenStates &&
// event types to hide: redaction and reaction events
// if a reaction has been redacted we also want it to be hidden in the timeline
!{EventTypes.Reaction, EventTypes.Redaction}.contains(type) &&
@ -39,4 +39,10 @@ extension IsStateExtension on Event {
EventTypes.RoomCreate,
EventTypes.RoomTombstone,
}.contains(type);
bool get isKnownHiddenStates =>
{
PollEventContent.responseType,
}.contains(type) ||
type.startsWith('m.key.verification.');
}

View file

@ -363,4 +363,10 @@ class MatrixLocals extends MatrixLocalizations {
@override
String get refreshingLastEvent => l10n.loadingPleaseWait;
@override
String startedAPoll(String senderName) => '$senderName started a poll';
@override
String get pollHasBeenEnded => l10n.pollHasBeenEnded;
}