Fetch replies in toMessage not at runtime

This commit is contained in:
Henry Hiles 2025-12-23 18:46:31 -05:00
commit 7ce4d3c9fb
No known key found for this signature in database
3 changed files with 67 additions and 90 deletions

View file

@ -15,13 +15,18 @@ extension EventToMessage on Event {
final newEvent = (unsigned?["m.relations"] as Map?)?["m.replace"];
final event = newEvent == null ? this : Event.fromJson(newEvent, room);
final replyEvent = replyId == null
? null
: await room.getEventById(replyId);
final newContent = event.content["m.new_content"] as Map?;
final metadata = {
"formatted":
newContent?["formatted_body"] ??
newContent?["body"] ??
event.content["formatted_body"] ??
event.content["body"],
event.body,
"reply": await replyEvent?.toMessage(mustBeText: true),
"eventType": event.type,
"displayName":
event.senderFromMemoryOrFallback.displayName ??