Watch
1
0
Fork
You've already forked nexus
0
forked from Nexus/nexus

treewide sweepfixes

This commit is contained in:
Henry Hiles 2026-10-14 17:01:39 -04:00
commit 012ecd9249
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
41 changed files with 270 additions and 386 deletions

View file

@ -88,7 +88,7 @@ class RoomChatController(final ChatParams info)
}
Future<void> deleteMessage(Event event, {String? reason}) => ref
.watch(ClientController.provider.notifier)
.read(ClientController.provider.notifier)
.redactEvent(
RedactEventRequest(
eventId: event.eventId,
@ -146,7 +146,7 @@ class RoomChatController(final ChatParams info)
);
if (response.events.isEmpty) {
state = .data(state.value);
state = .data(chat);
}
ref
@ -234,7 +234,7 @@ class RoomChatController(final ChatParams info)
Content? baseContent;
final relatedEvent = relatedEventRowId == null
? null
: ref.watch(
: ref.read(
RoomsController.provider.select(
(rooms) => rooms[info.roomId]?.events[relatedEventRowId],
),
@ -267,9 +267,7 @@ class RoomChatController(final ChatParams info)
baseContent: baseContent,
mentions: Mentions(
userIds: [
if (shouldMention == true &&
relatedEvent != null &&
relationType == RelationType.reply)
if (shouldMention && relatedEvent != null && relationType == .reply)
relatedEvent.sender,
].toIList(),
room: taggedMessage.contains("@room"),
@ -307,24 +305,20 @@ class RoomChatController(final ChatParams info)
),
);
final reactionEvents = allReactionEvents
?.where((event) => event.redactedBy == null)
.toIList();
final reactionEvent = reactionEvents?.firstWhereOrNull(
(event) => switch (event.content) {
ReactionContent(:final key) =>
key == reaction && event.sender == userId,
_ => false,
},
final reactionEvent = allReactionEvents?.firstWhereOrNull(
(event) =>
event.redactedBy == null &&
switch (event.content) {
ReactionContent(:final key) =>
key == reaction && event.sender == userId,
_ => false,
},
);
if (reactionEvent != null) {
await ref
.watch(ClientController.provider.notifier)
.redactEvent(
.new(eventId: reactionEvent.eventId, roomId: info.roomId),
);
await client.redactEvent(
.new(eventId: reactionEvent.eventId, roomId: info.roomId),
);
}
}