Skip to content

Commit 3705a5c

Browse files
committed
store: Add realmEmptyTopicDisplayName
Signed-off-by: Zixuan James Li <[email protected]>
1 parent 3920f82 commit 3705a5c

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

lib/api/model/initial_snapshot.dart

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

8181
final Uri? serverEmojiDataUrl; // TODO(server-6)
8282

83+
final String? realmEmptyTopicDisplayName; // TODO(server-10)
84+
8385
@JsonKey(readValue: _readUsersIsActiveFallbackTrue)
8486
final List<User> realmUsers;
8587
@JsonKey(readValue: _readUsersIsActiveFallbackFalse)
@@ -132,6 +134,7 @@ class InitialSnapshot {
132134
required this.realmDefaultExternalAccounts,
133135
required this.maxFileUploadSizeMib,
134136
required this.serverEmojiDataUrl,
137+
required this.realmEmptyTopicDisplayName,
135138
required this.realmUsers,
136139
required this.realmNonActiveUsers,
137140
required this.crossRealmBots,

lib/api/model/initial_snapshot.g.dart

Lines changed: 3 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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, ChannelStore, Mess
271271
realmMandatoryTopics: initialSnapshot.realmMandatoryTopics,
272272
realmWaitingPeriodThreshold: initialSnapshot.realmWaitingPeriodThreshold,
273273
maxFileUploadSizeMib: initialSnapshot.maxFileUploadSizeMib,
274+
realmEmptyTopicDisplayName: initialSnapshot.realmEmptyTopicDisplayName,
274275
realmDefaultExternalAccounts: initialSnapshot.realmDefaultExternalAccounts,
275276
customProfileFields: _sortCustomProfileFields(initialSnapshot.customProfileFields),
276277
emailAddressVisibility: initialSnapshot.emailAddressVisibility,
@@ -315,6 +316,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, ChannelStore, Mess
315316
required this.realmMandatoryTopics,
316317
required this.realmWaitingPeriodThreshold,
317318
required this.maxFileUploadSizeMib,
319+
required String? realmEmptyTopicDisplayName,
318320
required this.realmDefaultExternalAccounts,
319321
required this.customProfileFields,
320322
required this.emailAddressVisibility,
@@ -335,6 +337,7 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, ChannelStore, Mess
335337
assert(realmUrl == connection.realmUrl),
336338
assert(emoji.realmUrl == realmUrl),
337339
_globalStore = globalStore,
340+
_realmEmptyTopicDisplayName = realmEmptyTopicDisplayName,
338341
_emoji = emoji,
339342
_channels = channels,
340343
_messages = messages;
@@ -381,6 +384,11 @@ class PerAccountStore extends ChangeNotifier with EmojiStore, ChannelStore, Mess
381384
/// For docs, please see [InitialSnapshot.realmWaitingPeriodThreshold].
382385
final int realmWaitingPeriodThreshold; // TODO(#668): update this realm setting
383386
final int maxFileUploadSizeMib; // No event for this.
387+
final String? _realmEmptyTopicDisplayName; // TODO(#668): update this realm setting
388+
String get realmEmptyTopicDisplayName {
389+
assert(_realmEmptyTopicDisplayName != null); // TODO(log)
390+
return _realmEmptyTopicDisplayName ?? 'general chat';
391+
}
384392
final Map<String, RealmDefaultExternalAccount> realmDefaultExternalAccounts;
385393
List<CustomProfileField> customProfileFields;
386394
/// For docs, please see [InitialSnapshot.emailAddressVisibility].

test/example_data.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,8 @@ TestGlobalStore globalStore({List<Account> accounts = const []}) {
837837
return TestGlobalStore(accounts: accounts);
838838
}
839839

840+
const String defaultRealmEmptyTopicDisplayName = 'test general chat';
841+
840842
InitialSnapshot initialSnapshot({
841843
String? queueId,
842844
int? lastEventId,
@@ -861,6 +863,7 @@ InitialSnapshot initialSnapshot({
861863
Map<String, RealmDefaultExternalAccount>? realmDefaultExternalAccounts,
862864
int? maxFileUploadSizeMib,
863865
Uri? serverEmojiDataUrl,
866+
String? realmEmptyTopicDisplayName,
864867
List<User>? realmUsers,
865868
List<User>? realmNonActiveUsers,
866869
List<User>? crossRealmBots,
@@ -897,6 +900,7 @@ InitialSnapshot initialSnapshot({
897900
maxFileUploadSizeMib: maxFileUploadSizeMib ?? 25,
898901
serverEmojiDataUrl: serverEmojiDataUrl
899902
?? realmUrl.replace(path: '/static/emoji.json'),
903+
realmEmptyTopicDisplayName: realmEmptyTopicDisplayName ?? defaultRealmEmptyTopicDisplayName,
900904
realmUsers: realmUsers ?? [],
901905
realmNonActiveUsers: realmNonActiveUsers ?? [],
902906
crossRealmBots: crossRealmBots ?? [],

0 commit comments

Comments
 (0)