Skip to content

Commit 393d842

Browse files
gnpricechrisbobbe
authored andcommitted
api [nfc]: Reorder and rearrange Subscription fields to parallel Stream
This type is long enough to kind of push the limit for manually comparing the docs to the type when they're not in the same order. But in practice for future updates to it I think we can rely on reading through its API docs for "Changes" notes. And meanwhile, even within the API docs the `subscriptions` and the `streams` lists don't agree on the order of the fields, even among those they have in common. So we might as well give up on matching them and go for a logical order instead.
1 parent 7a8c448 commit 393d842

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

lib/api/model/model.dart

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,33 @@ class ZulipStream {
173173
/// in <https://zulip.com/api/register-queue>.
174174
@JsonSerializable(fieldRename: FieldRename.snake)
175175
class Subscription {
176+
// First, fields that are about the stream and not the user's relation to it.
177+
// These are largely the same as in [ZulipStream].
178+
176179
final int streamId;
177180
final String name;
178181
final String description;
179182
final String renderedDescription;
183+
180184
final int dateCreated;
181-
final bool inviteOnly;
185+
final int? firstMessageId;
186+
final int? streamWeeklyTraffic;
182187

188+
final bool inviteOnly;
189+
final bool? isWebPublic; // TODO(server-??): doc doesn't say when added
190+
final bool historyPublicToSubscribers;
191+
final int? messageRetentionDays;
183192
// final List<int> subscribers; // we register with includeSubscribers false
184193

194+
final int streamPostPolicy; // TODO enum
195+
// final bool? isAnnouncementOnly; // deprecated; ignore
196+
final String emailAddress;
197+
198+
final int? canRemoveSubscribersGroupId; // TODO(server-6)
199+
200+
// Then, fields that are specific to the subscription,
201+
// i.e. the user's relationship to the stream.
202+
185203
final bool? desktopNotifications;
186204
final bool? emailNotifications;
187205
final bool? wildcardMentionsNotify;
@@ -190,26 +208,11 @@ class Subscription {
190208

191209
final bool pinToTop;
192210

193-
final String emailAddress;
194-
195211
final bool isMuted;
196-
197212
// final bool? inHomeView; // deprecated; ignore
198213

199-
// final bool? isAnnouncementOnly; // deprecated; ignore
200-
final bool? isWebPublic; // TODO(server-??): doc doesn't say when added
201-
202214
final String color;
203215

204-
final int streamPostPolicy; // TODO enum
205-
final int? messageRetentionDays;
206-
final bool historyPublicToSubscribers;
207-
208-
final int? firstMessageId;
209-
final int? streamWeeklyTraffic;
210-
211-
final int? canRemoveSubscribersGroupId; // TODO(server-6)
212-
213216
Subscription({
214217
required this.streamId,
215218
required this.name,

0 commit comments

Comments
 (0)