Use gomuks editSource

This commit is contained in:
Henry Hiles 2026-03-01 13:58:43 -05:00
commit f4eea1b882
No known key found for this signature in database
3 changed files with 3 additions and 8 deletions

View file

@ -70,6 +70,7 @@ class MessageController extends AsyncNotifier<Message?> {
"body": newContent?["body"] ?? content["body"], "body": newContent?["body"] ?? content["body"],
"eventType": type, "eventType": type,
"avatarUrl": author?.content["avatar_url"], "avatarUrl": author?.content["avatar_url"],
"editSource": event.localContent?.editSource,
"displayName": author?.content["displayname"]?.isNotEmpty == true "displayName": author?.content["displayname"]?.isNotEmpty == true
? author?.content["displayname"] ? author?.content["displayname"]
: event.authorId.substring(1).split(":")[0], : event.authorId.substring(1).split(":")[0],

View file

@ -38,6 +38,7 @@ abstract class Event with _$Event {
abstract class LocalContent with _$LocalContent { abstract class LocalContent with _$LocalContent {
const factory LocalContent({ const factory LocalContent({
String? sanitizedHtml, String? sanitizedHtml,
String? editSource,
bool? wasPlaintext, bool? wasPlaintext,
bool? bigEmoji, bool? bigEmoji,
bool? hasMath, bool? hasMath,

View file

@ -34,14 +34,7 @@ class ChatBox extends HookConsumerWidget {
if (relationType == RelationType.edit && if (relationType == RelationType.edit &&
relatedMessage is TextMessage && relatedMessage is TextMessage &&
controller.value.text.isEmpty) { controller.value.text.isEmpty) {
final text = (relatedMessage as TextMessage).text; controller.value.text = relatedMessage?.metadata?["editSource"];
final splitText = relatedMessage?.replyToMessageId == null
? text
: text.split("\n\n").sublist(1).join("\n\n");
final notEmpty = splitText.isEmpty ? text : splitText;
controller.value.text = notEmpty.startsWith("* ")
? notEmpty.substring(2)
: notEmpty;
} }
void send() { void send() {