Skip to content

Commit 54d5e1c

Browse files
gnpricechrisbobbe
authored andcommitted
api [nfc]: Use TopicName type in ApiNarrow
1 parent 219972a commit 54d5e1c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/api/model/narrow.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import 'package:json_annotation/json_annotation.dart';
22

3+
import 'model.dart';
4+
35
part 'narrow.g.dart';
46

57
typedef ApiNarrow = List<ApiNarrowElement>;
@@ -54,12 +56,12 @@ class ApiNarrowStream extends ApiNarrowElement {
5456
class ApiNarrowTopic extends ApiNarrowElement {
5557
@override String get operator => 'topic';
5658

57-
@override final String operand;
59+
@override final TopicName operand;
5860

5961
ApiNarrowTopic(this.operand, {super.negated});
6062

6163
factory ApiNarrowTopic.fromJson(Map<String, dynamic> json) => ApiNarrowTopic(
62-
json['operand'] as String,
64+
TopicName.fromJson(json['operand'] as String),
6365
negated: json['negated'] as bool? ?? false,
6466
);
6567
}

lib/model/internal_link.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ Narrow? _interpretNarrowSegments(List<String> segments, PerAccountStore store) {
224224
} else if (streamElement != null) {
225225
final streamId = streamElement.operand;
226226
if (topicElement != null) {
227-
return TopicNarrow(streamId, TopicName.fromJson(topicElement.operand));
227+
return TopicNarrow(streamId, topicElement.operand);
228228
} else {
229229
return ChannelNarrow(streamId);
230230
}

0 commit comments

Comments
 (0)