diff --git a/lib/api/model/narrow.dart b/lib/api/model/narrow.dart index 7383d382ba..1cc854ae8e 100644 --- a/lib/api/model/narrow.dart +++ b/lib/api/model/narrow.dart @@ -34,14 +34,14 @@ sealed class ApiNarrowElement { }; } -class ApiNarrowStream extends ApiNarrowElement { +class ApiNarrowChannel extends ApiNarrowElement { @override String get operator => 'stream'; @override final int operand; - ApiNarrowStream(this.operand, {super.negated}); + ApiNarrowChannel(this.operand, {super.negated}); - factory ApiNarrowStream.fromJson(Map json) => ApiNarrowStream( + factory ApiNarrowChannel.fromJson(Map json) => ApiNarrowChannel( json['operand'] as int, negated: json['negated'] as bool? ?? false, ); diff --git a/lib/model/internal_link.dart b/lib/model/internal_link.dart index 422a0d8182..016ee02483 100644 --- a/lib/model/internal_link.dart +++ b/lib/model/internal_link.dart @@ -70,7 +70,7 @@ Uri narrowLink(PerAccountStore store, Narrow narrow, {int? nearMessageId}) { fragment.write('${element.operator}/'); switch (element) { - case ApiNarrowStream(): + case ApiNarrowChannel(): final streamId = element.operand; final name = store.streams[streamId]?.name ?? 'unknown'; final slugifiedName = _encodeHashComponent(name.replaceAll(' ', '-')); @@ -149,7 +149,7 @@ Narrow? _interpretNarrowSegments(List segments, PerAccountStore store) { assert(segments.isNotEmpty); assert(segments.length.isEven); - ApiNarrowStream? streamElement; + ApiNarrowChannel? channelElement; ApiNarrowTopic? topicElement; ApiNarrowDm? dmElement; @@ -160,10 +160,10 @@ Narrow? _interpretNarrowSegments(List segments, PerAccountStore store) { switch (operator) { case _NarrowOperator.stream: case _NarrowOperator.channel: - if (streamElement != null) return null; + if (channelElement != null) return null; final streamId = _parseStreamOperand(operand, store); if (streamId == null) return null; - streamElement = ApiNarrowStream(streamId, negated: negated); + channelElement = ApiNarrowChannel(streamId, negated: negated); case _NarrowOperator.topic: case _NarrowOperator.subject: @@ -189,10 +189,10 @@ Narrow? _interpretNarrowSegments(List segments, PerAccountStore store) { } if (dmElement != null) { - if (streamElement != null || topicElement != null) return null; + if (channelElement != null || topicElement != null) return null; return DmNarrow.withUsers(dmElement.operand, selfUserId: store.selfUserId); - } else if (streamElement != null) { - final streamId = streamElement.operand; + } else if (channelElement != null) { + final streamId = channelElement.operand; if (topicElement != null) { return TopicNarrow(streamId, topicElement.operand); } else { diff --git a/lib/model/narrow.dart b/lib/model/narrow.dart index a23caa40b9..26744d650e 100644 --- a/lib/model/narrow.dart +++ b/lib/model/narrow.dart @@ -76,7 +76,7 @@ class ChannelNarrow extends Narrow { } @override - ApiNarrow apiEncode() => [ApiNarrowStream(streamId)]; + ApiNarrow apiEncode() => [ApiNarrowChannel(streamId)]; @override String toString() => 'ChannelNarrow($streamId)'; @@ -108,7 +108,7 @@ class TopicNarrow extends Narrow implements SendableNarrow { } @override - ApiNarrow apiEncode() => [ApiNarrowStream(streamId), ApiNarrowTopic(topic)]; + ApiNarrow apiEncode() => [ApiNarrowChannel(streamId), ApiNarrowTopic(topic)]; @override StreamDestination get destination => StreamDestination(streamId, topic);