don't try to render redacted events
This commit is contained in:
parent
6534e2d46e
commit
e7ecae4606
3 changed files with 9 additions and 5 deletions
|
|
@ -3,13 +3,14 @@ import "package:nexus/models/content/content.dart";
|
|||
part "reaction.freezed.dart";
|
||||
part "reaction.g.dart";
|
||||
|
||||
String? keyFromJson(Map<String, dynamic> json) => json["key"];
|
||||
|
||||
@freezed
|
||||
abstract class ReactionContent extends Content with _$ReactionContent {
|
||||
ReactionContent._();
|
||||
static String? keyJsonFromJson(Map<dynamic, dynamic> json, String key) =>
|
||||
json["m.relates_to"]?["key"];
|
||||
|
||||
factory ReactionContent({
|
||||
@JsonKey(fromJson: keyFromJson, name: "m.relates_to") String? key,
|
||||
@JsonKey(readValue: ReactionContent.keyJsonFromJson) String? key,
|
||||
}) = _ReactionContent;
|
||||
|
||||
factory ReactionContent.fromJson(Map<String, Object?> json) =>
|
||||
|
|
|
|||
|
|
@ -62,12 +62,14 @@ class RenderEvent extends ConsumerWidget {
|
|||
children: getEventOptions!(event).toList(),
|
||||
);
|
||||
|
||||
if (event.redactedBy != null) return SizedBox.shrink();
|
||||
|
||||
final child = switch (event.content) {
|
||||
Content(:final parseError?) => SelectableText(
|
||||
"An error occurred while parsing this event:\n$parseError",
|
||||
"An error occurred while parsing this event:\n$parseError\n${parseError.stackTrace}",
|
||||
style: errorStyle,
|
||||
),
|
||||
EncryptedContent() => Text("Unable to decrypt event"),
|
||||
EncryptedContent() => Text("Unable to decrypt event", style: errorStyle),
|
||||
MessageContent() => Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 8,
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class LinkPreview extends ConsumerWidget {
|
|||
.watch(LaunchHelper.provider)
|
||||
.launchUrl(Uri.parse(link)),
|
||||
child: Card(
|
||||
margin: EdgeInsets.symmetric(vertical: 4),
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.surfaceContainerHighest,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue