Skip to content

Commit 2f91244

Browse files
committed
store: Add realmMandatoryTopics realm setting
Signed-off-by: Zixuan James Li <[email protected]>
1 parent c52961d commit 2f91244

File tree

5 files changed

+11
-0
lines changed

5 files changed

+11
-0
lines changed

lib/api/model/initial_snapshot.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class InitialSnapshot {
6464

6565
final List<UserTopicItem>? userTopics; // TODO(server-6)
6666

67+
final bool realmMandatoryTopics;
68+
6769
/// The number of days until a user's account is treated as a full member.
6870
///
6971
/// Search for "realm_waiting_period_threshold" in https://zulip.com/api/register-queue.
@@ -125,6 +127,7 @@ class InitialSnapshot {
125127
required this.streams,
126128
required this.userSettings,
127129
required this.userTopics,
130+
required this.realmMandatoryTopics,
128131
required this.realmWaitingPeriodThreshold,
129132
required this.realmDefaultExternalAccounts,
130133
required this.maxFileUploadSizeMib,

lib/api/model/initial_snapshot.g.dart

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/model/store.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, ChannelStore, Mess
268268
globalStore: globalStore,
269269
connection: connection,
270270
realmUrl: realmUrl,
271+
realmMandatoryTopics: initialSnapshot.realmMandatoryTopics,
271272
realmWaitingPeriodThreshold: initialSnapshot.realmWaitingPeriodThreshold,
272273
maxFileUploadSizeMib: initialSnapshot.maxFileUploadSizeMib,
273274
realmDefaultExternalAccounts: initialSnapshot.realmDefaultExternalAccounts,
@@ -311,6 +312,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, ChannelStore, Mess
311312
required GlobalStore globalStore,
312313
required this.connection,
313314
required this.realmUrl,
315+
required this.realmMandatoryTopics,
314316
required this.realmWaitingPeriodThreshold,
315317
required this.maxFileUploadSizeMib,
316318
required this.realmDefaultExternalAccounts,
@@ -375,6 +377,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, ChannelStore, Mess
375377
Uri? tryResolveUrl(String reference) => _tryResolveUrl(realmUrl, reference);
376378

377379
String get zulipVersion => account.zulipVersion;
380+
final bool realmMandatoryTopics; // TODO(#668): update this realm setting
378381
/// For docs, please see [InitialSnapshot.realmWaitingPeriodThreshold].
379382
final int realmWaitingPeriodThreshold; // TODO(#668): update this realm setting
380383
final int maxFileUploadSizeMib; // No event for this.

test/example_data.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,7 @@ InitialSnapshot initialSnapshot({
856856
List<ZulipStream>? streams,
857857
UserSettings? userSettings,
858858
List<UserTopicItem>? userTopics,
859+
bool? realmMandatoryTopics,
859860
int? realmWaitingPeriodThreshold,
860861
Map<String, RealmDefaultExternalAccount>? realmDefaultExternalAccounts,
861862
int? maxFileUploadSizeMib,
@@ -890,6 +891,7 @@ InitialSnapshot initialSnapshot({
890891
emojiset: Emojiset.google,
891892
),
892893
userTopics: userTopics,
894+
realmMandatoryTopics: realmMandatoryTopics ?? false,
893895
realmWaitingPeriodThreshold: realmWaitingPeriodThreshold ?? 0,
894896
realmDefaultExternalAccounts: realmDefaultExternalAccounts ?? {},
895897
maxFileUploadSizeMib: maxFileUploadSizeMib ?? 25,

test/model/store_checks.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ extension PerAccountStoreChecks on Subject<PerAccountStore> {
3131
Subject<bool> get isLoading => has((x) => x.isLoading, 'isLoading');
3232
Subject<Uri> get realmUrl => has((x) => x.realmUrl, 'realmUrl');
3333
Subject<String> get zulipVersion => has((x) => x.zulipVersion, 'zulipVersion');
34+
Subject<bool> get realmMandatoryTopics => has((x) => x.realmMandatoryTopics, 'realmMandatoryTopics');
3435
Subject<int> get maxFileUploadSizeMib => has((x) => x.maxFileUploadSizeMib, 'maxFileUploadSizeMib');
3536
Subject<Map<String, RealmDefaultExternalAccount>> get realmDefaultExternalAccounts => has((x) => x.realmDefaultExternalAccounts, 'realmDefaultExternalAccounts');
3637
Subject<List<CustomProfileField>> get customProfileFields => has((x) => x.customProfileFields, 'customProfileFields');

0 commit comments

Comments
 (0)