fix reactions on edited messages

This commit is contained in:
Henry Hiles 2026-04-12 13:23:05 -04:00
commit 6b8eef3f17
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -15,8 +15,8 @@ class MessageController extends AsyncNotifier<Message?> {
@override @override
Future<Message?> build() async { Future<Message?> build() async {
try { try {
if ((config.event.relationType == "m.replace" && !config.includeEdits) || final isEdit = config.event.relationType == "m.replace";
config.room.metadata == null) { if ((isEdit && !config.includeEdits) || config.room.metadata == null) {
return null; return null;
} }
@ -68,14 +68,16 @@ class MessageController extends AsyncNotifier<Message?> {
final replyId = final replyId =
config.event.content["m.relates_to"]?["m.in_reply_to"]?["event_id"]; config.event.content["m.relates_to"]?["m.in_reply_to"]?["event_id"];
final reactionEvents = event.reactions.isEmpty final reactionEvents = config.event.reactions.isEmpty && !isEdit
? null ? null
: await ref : await ref
.watch(ClientController.provider.notifier) .watch(ClientController.provider.notifier)
.getRelatedEvents( .getRelatedEvents(
GetRelatedEventsRequest( GetRelatedEventsRequest(
roomId: config.room.metadata!.id, roomId: config.room.metadata!.id,
eventId: config.event.eventId, eventId:
(isEdit ? config.event.relatesTo : null) ??
config.event.eventId,
relationType: "m.annotation", relationType: "m.annotation",
), ),
); );