Skip to content

Commit 5caa859

Browse files
sm-sayedichrisbobbe
authored andcommitted
api: Add InitialSnapshot.mutedUsers
Co-authored-by: Chris Bobbe <[email protected]>
1 parent 7e29108 commit 5caa859

File tree

5 files changed

+34
-0
lines changed

5 files changed

+34
-0
lines changed

lib/api/model/initial_snapshot.dart

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

4545
// final List<…> mutedTopics; // TODO(#422) we ignore this feature on older servers
4646

47+
final List<MutedUserItem> mutedUsers;
48+
4749
final Map<String, RealmEmojiItem> realmEmoji;
4850

4951
final List<RecentDmConversation> recentPrivateConversations;
@@ -132,6 +134,7 @@ class InitialSnapshot {
132134
required this.serverTypingStartedExpiryPeriodMilliseconds,
133135
required this.serverTypingStoppedWaitPeriodMilliseconds,
134136
required this.serverTypingStartedWaitPeriodMilliseconds,
137+
required this.mutedUsers,
135138
required this.realmEmoji,
136139
required this.recentPrivateConversations,
137140
required this.savedSnippets,

lib/api/model/initial_snapshot.g.dart

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

lib/api/model/model.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,25 @@ class CustomProfileFieldExternalAccountData {
110110
Map<String, dynamic> toJson() => _$CustomProfileFieldExternalAccountDataToJson(this);
111111
}
112112

113+
/// An item in the [InitialSnapshot.mutedUsers].
114+
///
115+
/// For docs, search for "muted_users:"
116+
/// in <https://zulip.com/api/register-queue>.
117+
@JsonSerializable(fieldRename: FieldRename.snake)
118+
class MutedUserItem {
119+
final int id;
120+
121+
// Mobile doesn't use the timestamp; ignore.
122+
// final int timestamp;
123+
124+
const MutedUserItem({required this.id});
125+
126+
factory MutedUserItem.fromJson(Map<String, dynamic> json) =>
127+
_$MutedUserItemFromJson(json);
128+
129+
Map<String, dynamic> toJson() => _$MutedUserItemToJson(this);
130+
}
131+
113132
/// An item in [InitialSnapshot.realmEmoji] or [RealmEmojiUpdateEvent].
114133
///
115134
/// For docs, search for "realm_emoji:"

lib/api/model/model.g.dart

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

test/example_data.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,7 @@ InitialSnapshot initialSnapshot({
10981098
int? serverTypingStartedExpiryPeriodMilliseconds,
10991099
int? serverTypingStoppedWaitPeriodMilliseconds,
11001100
int? serverTypingStartedWaitPeriodMilliseconds,
1101+
List<MutedUserItem>? mutedUsers,
11011102
Map<String, RealmEmojiItem>? realmEmoji,
11021103
List<RecentDmConversation>? recentPrivateConversations,
11031104
List<SavedSnippet>? savedSnippets,
@@ -1134,6 +1135,7 @@ InitialSnapshot initialSnapshot({
11341135
serverTypingStoppedWaitPeriodMilliseconds ?? 5000,
11351136
serverTypingStartedWaitPeriodMilliseconds:
11361137
serverTypingStartedWaitPeriodMilliseconds ?? 10000,
1138+
mutedUsers: mutedUsers ?? [],
11371139
realmEmoji: realmEmoji ?? {},
11381140
recentPrivateConversations: recentPrivateConversations ?? [],
11391141
savedSnippets: savedSnippets ?? [],

0 commit comments

Comments
 (0)