Skip to content

Commit ebe4e9b

Browse files
gnpricechrisbobbe
authored andcommitted
api [nfc]: Use TopicName type in decoding message edit history
1 parent 191dab0 commit ebe4e9b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/api/model/model.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -871,8 +871,10 @@ enum MessageEditState {
871871
}
872872

873873
// TODO(server-5) prev_subject was the old name of prev_topic on pre-5.0 servers
874-
final prevTopic = (entry['prev_topic'] ?? entry['prev_subject']) as String?;
875-
final topic = entry['topic'] as String?;
874+
final prevTopicStr = (entry['prev_topic'] ?? entry['prev_subject']) as String?;
875+
final prevTopic = prevTopicStr == null ? null : TopicName.fromJson(prevTopicStr);
876+
final topicStr = entry['topic'] as String?;
877+
final topic = topicStr == null ? null : TopicName.fromJson(topicStr);
876878
if (prevTopic != null) {
877879
// TODO(server-5) pre-5.0 servers do not have the 'topic' field
878880
if (topic == null) {

0 commit comments

Comments
 (0)