Use gomuks editSource
This commit is contained in:
parent
2b4da17a35
commit
f4eea1b882
3 changed files with 3 additions and 8 deletions
|
|
@ -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],
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue