Remove flutter chat #26
3 changed files with 20 additions and 9 deletions
working edits
commit
7761ca73fd
|
|
@ -62,11 +62,21 @@ class RoomChatController extends AsyncNotifier<IList<Event>> {
|
|||
}
|
||||
|
||||
return room.timeline.reversed
|
||||
.map(
|
||||
(timeline) => room.events.firstWhereOrNull(
|
||||
.map((timeline) {
|
||||
final foundEvent = room.events.firstWhereOrNull(
|
||||
(event) => event.rowId == timeline.eventRowId,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
final editedEvent = foundEvent?.lastEditRowId == 0
|
||||
? null
|
||||
: room.events.firstWhereOrNull(
|
||||
(event) => event.rowId == foundEvent?.lastEditRowId,
|
||||
);
|
||||
|
||||
return foundEvent?.copyWith(
|
||||
content: editedEvent?.content ?? foundEvent.content,
|
||||
);
|
||||
})
|
||||
.nonNulls
|
||||
.toIList();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ abstract class Event with _$Event {
|
|||
String? decryptionError,
|
||||
String? sendError,
|
||||
@Default(IMap.empty()) IMap<String, int> reactions,
|
||||
@JsonKey(name: "last_edit_rowid") int? lastEditRowId,
|
||||
@JsonKey(name: "last_edit_rowid") @Default(0) int lastEditRowId,
|
||||
@UnreadTypeConverter() UnreadType? unreadType,
|
||||
@JsonKey(fromJson: Event.pmpFromJson) Profile? pmp,
|
||||
required Content content,
|
||||
|
|
@ -44,7 +44,9 @@ abstract class Event with _$Event {
|
|||
factory Event.fromJson(Map<String, dynamic> json) =>
|
||||
_$EventFromJson(json).copyWith(
|
||||
content: Content.fromEventJson(
|
||||
json["decrypted"] ?? json["content"],
|
||||
(json["decrypted"] ?? json["content"])["m.new_content"] ??
|
||||
json["decrypted"] ??
|
||||
json["content"],
|
||||
json["decrypted_type"] ?? json["type"],
|
||||
),
|
||||
previousContent: json["unsigned"]?["prev_content"] == null
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class EventRenderer extends ConsumerWidget {
|
|||
fontStyle: event.content is EmoteMessageContent ? FontStyle.italic : null,
|
||||
);
|
||||
|
||||
final child = event.redactedBy != null
|
||||
final child = event.redactedBy != null || event.relationType == "m.replace"
|
||||
? null
|
||||
: switch (event.content) {
|
||||
Content(:final parseError?) => SelectableText(
|
||||
|
|
@ -344,8 +344,7 @@ class EventRenderer extends ConsumerWidget {
|
|||
style: errorStyle,
|
||||
),
|
||||
},
|
||||
if (event.lastEditRowId != null &&
|
||||
!textOnly)
|
||||
if (event.lastEditRowId != 0 && !textOnly)
|
||||
Text(
|
||||
"(edited)",
|
||||
style: theme.textTheme.labelSmall,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue