Skip to content

Commit f978e51

Browse files
committed
channel [nfc]: Add HasChannelStore for other substores to use
Like HasUserStore for data about users (added in 623bcb4), and HasRealmStore for data about the realm, this will help make it convenient for other substores to refer to data about channels.
1 parent 9c37ed4 commit f978e51

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/model/channel.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ import 'user.dart';
1616
///
1717
/// The data structures described here are implemented at [ChannelStoreImpl].
1818
mixin ChannelStore on UserStore {
19+
@protected
20+
UserStore get userStore;
21+
1922
/// All known channels/streams, indexed by [ZulipStream.streamId].
2023
///
2124
/// The same [ZulipStream] objects also appear in [streamsByName].
@@ -248,6 +251,18 @@ mixin ProxyChannelStore on ChannelStore {
248251
channelStore.debugTopicVisibility;
249252
}
250253

254+
/// A base class for [PerAccountStore] substores
255+
/// that need access to [ChannelStore] as well as to its prerequisites
256+
/// [CorePerAccountStore], [RealmStore], and [UserStore].
257+
abstract class HasChannelStore extends HasUserStore with ChannelStore, ProxyChannelStore {
258+
HasChannelStore({required ChannelStore channels})
259+
: channelStore = channels, super(users: channels.userStore);
260+
261+
@protected
262+
@override
263+
final ChannelStore channelStore;
264+
}
265+
251266
/// The implementation of [ChannelStore] that does the work.
252267
///
253268
/// Generally the only code that should need this class is [PerAccountStore]

0 commit comments

Comments
 (0)