Skip to content

Commit 886245f

Browse files
committed
api: Make userTopics required in initial snapshot
Fixes-partly: #1837
1 parent 944c068 commit 886245f

File tree

5 files changed

+5
-8
lines changed

5 files changed

+5
-8
lines changed

lib/api/model/events.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ sealed class Event {
7171
case 'peer_remove': return SubscriptionPeerRemoveEvent.fromJson(json);
7272
default: return UnexpectedEvent.fromJson(json);
7373
}
74-
// case 'muted_topics': … // TODO(#422) we ignore this feature on older servers
7574
case 'user_status': return UserStatusEvent.fromJson(json);
7675
case 'user_topic': return UserTopicEvent.fromJson(json);
7776
case 'muted_users': return MutedUsersEvent.fromJson(json);

lib/api/model/initial_snapshot.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ class InitialSnapshot {
3535
@JsonKey(defaultValue: 10000)
3636
final int serverTypingStartedWaitPeriodMilliseconds;
3737

38-
// final List<…> mutedTopics; // TODO(#422) we ignore this feature on older servers
39-
4038
final List<MutedUserItem> mutedUsers;
4139

4240
// In the modern format because we pass `slim_presence`.
@@ -70,7 +68,7 @@ class InitialSnapshot {
7068

7169
final UserSettings userSettings;
7270

73-
final List<UserTopicItem>? userTopics; // TODO(server-6)
71+
final List<UserTopicItem> userTopics;
7472

7573
final GroupSettingValue? realmCanDeleteAnyMessageGroup; // TODO(server-10)
7674

lib/api/model/initial_snapshot.g.dart

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

lib/model/channel.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ class ChannelStoreImpl extends HasUserStore with ChannelStore {
307307
}
308308

309309
final topicVisibility = <int, TopicKeyedMap<UserTopicVisibilityPolicy>>{};
310-
for (final item in initialSnapshot.userTopics ?? const <UserTopicItem>[]) {
310+
for (final item in initialSnapshot.userTopics) {
311311
if (_warnInvalidVisibilityPolicy(item.visibilityPolicy)) {
312312
// Not a value we expect. Keep it out of our data structures. // TODO(log)
313313
continue;

test/example_data.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ InitialSnapshot initialSnapshot({
13341334
emojiset: Emojiset.google,
13351335
presenceEnabled: true,
13361336
),
1337-
userTopics: userTopics,
1337+
userTopics: userTopics ?? [],
13381338
// no default; allow `null` to simulate servers without this
13391339
realmCanDeleteAnyMessageGroup: realmCanDeleteAnyMessageGroup,
13401340
realmCanDeleteOwnMessageGroup: realmCanDeleteOwnMessageGroup,

0 commit comments

Comments
 (0)