Skip to content

Commit 84b64fc

Browse files
committed
unreads [nfc]: Rename countInChannel from "stream", to match its twin
This way its name continues to parallel that of countInChannelNarrow. Also say "channel" in the two methods' docs.
1 parent 01c8924 commit 84b64fc

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lib/model/unreads.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,16 @@ class Unreads extends ChangeNotifier {
144144
return c;
145145
}
146146

147-
/// The "strict" unread count for this stream,
147+
/// The "strict" unread count for this channel,
148148
/// using [ChannelStore.isTopicVisible].
149149
///
150-
/// If the stream is muted, this will count only topics that are
150+
/// If the channel is muted, this will count only topics that are
151151
/// actively unmuted.
152152
///
153153
/// For a count that's appropriate in UI contexts that are focused
154-
/// specifically on this stream, see [countInChannelNarrow].
154+
/// specifically on this channel, see [countInChannelNarrow].
155155
// TODO(#370): maintain this count incrementally, rather than recomputing from scratch
156-
int countInStream(int streamId) {
156+
int countInChannel(int streamId) {
157157
final topics = streams[streamId];
158158
if (topics == null) return 0;
159159
int c = 0;
@@ -165,14 +165,14 @@ class Unreads extends ChangeNotifier {
165165
return c;
166166
}
167167

168-
/// The "broad" unread count for this stream,
168+
/// The "broad" unread count for this channel,
169169
/// using [ChannelStore.isTopicVisibleInStream].
170170
///
171171
/// This includes topics that have no visibility policy of their own,
172-
/// even if the stream itself is muted.
172+
/// even if the channel itself is muted.
173173
///
174174
/// For a count that's appropriate in UI contexts that are not already
175-
/// focused on this stream, see [countInStream].
175+
/// focused on this channel, see [countInChannel].
176176
// TODO(#370): maintain this count incrementally, rather than recomputing from scratch
177177
int countInChannelNarrow(int streamId) {
178178
final topics = streams[streamId];

lib/widgets/subscription_list.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class _SubscriptionList extends StatelessWidget {
187187
itemCount: subscriptions.length,
188188
itemBuilder: (BuildContext context, int index) {
189189
final subscription = subscriptions[index];
190-
final unreadCount = unreadsModel!.countInStream(subscription.streamId);
190+
final unreadCount = unreadsModel!.countInChannel(subscription.streamId);
191191
// TODO(#712): if stream muted, show a dot for unreads
192192
return SubscriptionItem(subscription: subscription, unreadCount: unreadCount);
193193
});

test/model/unreads_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,13 @@ void main() {
189189
eg.streamMessage(stream: stream, topic: 'b', flags: []),
190190
eg.streamMessage(stream: stream, topic: 'c', flags: []),
191191
]);
192-
check(model.countInStream (stream.streamId)).equals(5);
192+
check(model.countInChannel (stream.streamId)).equals(5);
193193
check(model.countInChannelNarrow(stream.streamId)).equals(5);
194194

195195
await channelStore.handleEvent(SubscriptionUpdateEvent(id: 1,
196196
streamId: stream.streamId,
197197
property: SubscriptionProperty.isMuted, value: true));
198-
check(model.countInStream (stream.streamId)).equals(2);
198+
check(model.countInChannel (stream.streamId)).equals(2);
199199
check(model.countInChannelNarrow(stream.streamId)).equals(5);
200200
});
201201

0 commit comments

Comments
 (0)