fixup PMPs in encrypted rooms

This commit is contained in:
Henry Hiles 2026-11-26 15:54:51 -05:00
commit 225497030e
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -65,14 +65,15 @@ class const Event({
} }
} }
factory Event.fromJson(Map<String, dynamic> json) => factory Event.fromJson(Map<String, dynamic> json) => _$EventFromJson(json)
_$EventFromJson(json).copyWith( .copyWith(
replyTo: replyToFromJson(getContentFromJson(json)), replyTo: replyToFromJson(getContentFromJson(json)),
pmp: json["content"]?["com.beeper.per_message_profile"] == null pmp: switch (getContentFromJson(
? null json,
: .fromJsonWithCatch( )["com.beeper.per_message_profile"]) {
json["content"]?["com.beeper.per_message_profile"], null => null,
), final pmp => .fromJsonWithCatch(pmp),
},
content: .fromEventJson( content: .fromEventJson(
getContentFromJson(json), getContentFromJson(json),
json["decrypted_type"] ?? json["type"], json["decrypted_type"] ?? json["type"],