Skip to content

Commit f0d11a9

Browse files
committed
api: Update Subscription for API changes
Complete rename of `canRemoveSubscribersGroupId` that was done in `ZulipStream` in previous commit. Also change `isWebPublic` to be non-null. It has been a field on subscriptions since at least FL 8 (see zulip/zulip@f93c19ec6 in `zerver/openapi/zulip.yaml` and the docs attached to `Subscription.API_FIELDS` in `zerver/models.py`).
1 parent a218132 commit f0d11a9

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

lib/api/model/model.dart

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,15 +326,18 @@ class Subscription {
326326
final int? streamWeeklyTraffic;
327327

328328
final bool inviteOnly;
329-
final bool? isWebPublic; // TODO(server-??): doc doesn't say when added
329+
final bool isWebPublic;
330330
final bool historyPublicToSubscribers;
331331
final int? messageRetentionDays;
332332
// final List<int> subscribers; // we register with includeSubscribers false
333333

334334
final StreamPostPolicy streamPostPolicy;
335335
// final bool? isAnnouncementOnly; // deprecated for `streamPostPolicy`; ignore
336336

337-
final int? canRemoveSubscribersGroupId; // TODO(server-6)
337+
// TODO(server-6): `canRemoveSubscribersGroupId` added in FL 142
338+
// TODO(server-8): in FL 197 renamed to `canRemoveSubscribersGroup`
339+
@JsonKey(readValue: _readCanRemoveSubscribersGroup)
340+
final int? canRemoveSubscribersGroup;
338341

339342
// Then, fields that are specific to the subscription,
340343
// i.e. the user's relationship to the stream.
@@ -352,6 +355,10 @@ class Subscription {
352355

353356
final String color;
354357

358+
static int? _readCanRemoveSubscribersGroup(Map json, String key) {
359+
return json[key] ?? json['can_remove_subscribers_group_id'];
360+
}
361+
355362
Subscription({
356363
required this.streamId,
357364
required this.name,
@@ -373,7 +380,7 @@ class Subscription {
373380
required this.historyPublicToSubscribers,
374381
required this.firstMessageId,
375382
required this.streamWeeklyTraffic,
376-
required this.canRemoveSubscribersGroupId,
383+
required this.canRemoveSubscribersGroup,
377384
});
378385

379386
factory Subscription.fromJson(Map<String, dynamic> json) =>

lib/api/model/model.g.dart

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

0 commit comments

Comments
 (0)