Skip to content

Commit 1d57eeb

Browse files
author
MritunjayTiwari14
committed
2 parents 907669f + a45b0e3 commit 1d57eeb

File tree

14 files changed

+988
-29
lines changed

14 files changed

+988
-29
lines changed
51.3 KB
Binary file not shown.

lib/api/model/events.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,9 @@ class ChannelUpdateEvent extends ChannelEvent {
664664
final value = json['value'];
665665
switch (ChannelPropertyName.fromRawString(json['property'] as String)) {
666666
case ChannelPropertyName.name:
667+
return value as String;
668+
case ChannelPropertyName.isArchived:
669+
return value as bool;
667670
case ChannelPropertyName.description:
668671
return value as String;
669672
case ChannelPropertyName.firstMessageId:
@@ -675,6 +678,8 @@ class ChannelUpdateEvent extends ChannelEvent {
675678
case ChannelPropertyName.channelPostPolicy:
676679
return ChannelPostPolicy.fromApiValue(value as int);
677680
case ChannelPropertyName.canAddSubscribersGroup:
681+
case ChannelPropertyName.canDeleteAnyMessageGroup:
682+
case ChannelPropertyName.canDeleteOwnMessageGroup:
678683
case ChannelPropertyName.canSubscribeGroup:
679684
return GroupSettingValue.fromJson(value);
680685
case ChannelPropertyName.streamWeeklyTraffic:

lib/api/model/events.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/api/model/initial_snapshot.dart

Lines changed: 167 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ class InitialSnapshot {
7272

7373
final List<UserTopicItem>? userTopics; // TODO(server-6)
7474

75+
final GroupSettingValue? realmCanDeleteAnyMessageGroup; // TODO(server-10)
76+
77+
final GroupSettingValue? realmCanDeleteOwnMessageGroup; // TODO(server-10)
78+
79+
/// The policy for who can delete their own messages,
80+
/// on supported servers below version 10.
81+
///
82+
/// Removed in FL 291, so absent in the current API doc;
83+
/// see zulip/zulip@0cd51f2fe.
84+
final RealmDeleteOwnMessagePolicy? realmDeleteOwnMessagePolicy; // TODO(server-10)
85+
7586
/// The policy for who can use wildcard mentions in large channels.
7687
///
7788
/// Search for "realm_wildcard_mention_policy" in https://zulip.com/api/register-queue.
@@ -87,6 +98,8 @@ class InitialSnapshot {
8798
/// https://zulip.com/api/roles-and-permissions#determining-if-a-user-is-a-full-member
8899
final int realmWaitingPeriodThreshold;
89100

101+
final int? realmMessageContentDeleteLimitSeconds;
102+
90103
final bool realmAllowMessageEditing;
91104
final int? realmMessageContentEditLimitSeconds;
92105

@@ -158,9 +171,13 @@ class InitialSnapshot {
158171
required this.userStatuses,
159172
required this.userSettings,
160173
required this.userTopics,
174+
required this.realmCanDeleteAnyMessageGroup,
175+
required this.realmCanDeleteOwnMessageGroup,
176+
required this.realmDeleteOwnMessagePolicy,
161177
required this.realmWildcardMentionPolicy,
162178
required this.realmMandatoryTopics,
163179
required this.realmWaitingPeriodThreshold,
180+
required this.realmMessageContentDeleteLimitSeconds,
164181
required this.realmAllowMessageEditing,
165182
required this.realmMessageContentEditLimitSeconds,
166183
required this.realmEnableReadReceipts,
@@ -196,6 +213,21 @@ enum RealmWildcardMentionPolicy {
196213
int? toJson() => apiValue;
197214
}
198215

216+
@JsonEnum(valueField: 'apiValue')
217+
enum RealmDeleteOwnMessagePolicy {
218+
members(apiValue: 1),
219+
admins(apiValue: 2),
220+
fullMembers(apiValue: 3),
221+
moderators(apiValue: 4),
222+
everyone(apiValue: 5);
223+
224+
const RealmDeleteOwnMessagePolicy({required this.apiValue});
225+
226+
final int apiValue;
227+
228+
int toJson() => apiValue;
229+
}
230+
199231
/// An item in `realm_default_external_accounts`.
200232
///
201233
/// For docs, search for "realm_default_external_accounts:"
@@ -425,7 +457,141 @@ class SupportedPermissionSettings {
425457
/// or a similar API, and switch to using that. See thread:
426458
/// https://chat.zulip.org/#narrow/channel/378-api-design/topic/server_supported_permission_settings/near/2247549
427459
static SupportedPermissionSettings fixture = SupportedPermissionSettings(
428-
realm: {}, // Please go ahead and fill this in when we come to need it.
460+
realm: {
461+
// From the server's Realm.REALM_PERMISSION_GROUP_SETTINGS,
462+
// in zerver/models/realms.py. Current as of 6ab30fcce, 2025-08.
463+
'create_multiuse_invite_group': PermissionSettingsItem(
464+
// allow_nobody_group=True,
465+
allowEveryoneGroup: false,
466+
// default_group_name=SystemGroups.ADMINISTRATORS,
467+
),
468+
'can_access_all_users_group': PermissionSettingsItem(
469+
// require_system_group=True,
470+
// allow_nobody_group=False,
471+
allowEveryoneGroup: true,
472+
// default_group_name=SystemGroups.EVERYONE,
473+
// # Note that user_can_access_all_other_users in the web
474+
// # app is relying on members always have access.
475+
// allowed_system_groups=[SystemGroups.EVERYONE, SystemGroups.MEMBERS],
476+
),
477+
'can_add_subscribers_group': PermissionSettingsItem(
478+
// allow_nobody_group=True,
479+
allowEveryoneGroup: false,
480+
// default_group_name=SystemGroups.MEMBERS,
481+
),
482+
'can_add_custom_emoji_group': PermissionSettingsItem(
483+
// allow_nobody_group=True,
484+
allowEveryoneGroup: false,
485+
// default_group_name=SystemGroups.MEMBERS,
486+
),
487+
'can_create_bots_group': PermissionSettingsItem(
488+
// allow_nobody_group=True,
489+
allowEveryoneGroup: false,
490+
// default_group_name=SystemGroups.MEMBERS,
491+
),
492+
'can_create_groups': PermissionSettingsItem(
493+
// allow_nobody_group=True,
494+
allowEveryoneGroup: false,
495+
// default_group_name=SystemGroups.MEMBERS,
496+
),
497+
'can_create_public_channel_group': PermissionSettingsItem(
498+
// allow_nobody_group=True,
499+
allowEveryoneGroup: false,
500+
// default_group_name=SystemGroups.MEMBERS,
501+
),
502+
'can_create_private_channel_group': PermissionSettingsItem(
503+
// allow_nobody_group=True,
504+
allowEveryoneGroup: false,
505+
// default_group_name=SystemGroups.MEMBERS,
506+
),
507+
'can_create_web_public_channel_group': PermissionSettingsItem(
508+
// require_system_group=True,
509+
// allow_nobody_group=True,
510+
allowEveryoneGroup: false,
511+
// default_group_name=SystemGroups.OWNERS,
512+
// allowed_system_groups=[
513+
// SystemGroups.MODERATORS,
514+
// SystemGroups.ADMINISTRATORS,
515+
// SystemGroups.OWNERS,
516+
// SystemGroups.NOBODY,
517+
// ],
518+
),
519+
'can_create_write_only_bots_group': PermissionSettingsItem(
520+
// allow_nobody_group=True,
521+
allowEveryoneGroup: false,
522+
// default_group_name=SystemGroups.MEMBERS,
523+
),
524+
'can_delete_any_message_group': PermissionSettingsItem(
525+
// allow_nobody_group=True,
526+
allowEveryoneGroup: false,
527+
// default_group_name=SystemGroups.ADMINISTRATORS,
528+
),
529+
'can_delete_own_message_group': PermissionSettingsItem(
530+
// allow_nobody_group=True,
531+
allowEveryoneGroup: true,
532+
// default_group_name=SystemGroups.EVERYONE,
533+
),
534+
'can_invite_users_group': PermissionSettingsItem(
535+
// allow_nobody_group=True,
536+
allowEveryoneGroup: false,
537+
// default_group_name=SystemGroups.MEMBERS,
538+
),
539+
'can_manage_all_groups': PermissionSettingsItem(
540+
// allow_nobody_group=False,
541+
allowEveryoneGroup: false,
542+
// default_group_name=SystemGroups.OWNERS,
543+
),
544+
'can_manage_billing_group': PermissionSettingsItem(
545+
// allow_nobody_group=False,
546+
allowEveryoneGroup: false,
547+
// default_group_name=SystemGroups.ADMINISTRATORS,
548+
),
549+
'can_mention_many_users_group': PermissionSettingsItem(
550+
// allow_nobody_group=True,
551+
allowEveryoneGroup: true,
552+
// default_group_name=SystemGroups.ADMINISTRATORS,
553+
),
554+
'can_move_messages_between_channels_group': PermissionSettingsItem(
555+
// allow_nobody_group=True,
556+
allowEveryoneGroup: false,
557+
// default_group_name=SystemGroups.MEMBERS,
558+
),
559+
'can_move_messages_between_topics_group': PermissionSettingsItem(
560+
// allow_nobody_group=True,
561+
allowEveryoneGroup: true,
562+
// default_group_name=SystemGroups.EVERYONE,
563+
),
564+
'can_resolve_topics_group': PermissionSettingsItem(
565+
// allow_nobody_group=True,
566+
allowEveryoneGroup: true,
567+
// default_group_name=SystemGroups.EVERYONE,
568+
),
569+
'can_set_delete_message_policy_group': PermissionSettingsItem(
570+
// allow_nobody_group=True,
571+
allowEveryoneGroup: false,
572+
// default_group_name=SystemGroups.MODERATORS,
573+
),
574+
'can_set_topics_policy_group': PermissionSettingsItem(
575+
// allow_nobody_group=True,
576+
allowEveryoneGroup: true,
577+
// default_group_name=SystemGroups.MEMBERS,
578+
),
579+
'can_summarize_topics_group': PermissionSettingsItem(
580+
// allow_nobody_group=True,
581+
allowEveryoneGroup: true,
582+
// default_group_name=SystemGroups.EVERYONE,
583+
),
584+
'direct_message_initiator_group': PermissionSettingsItem(
585+
// allow_nobody_group=True,
586+
allowEveryoneGroup: true,
587+
// default_group_name=SystemGroups.EVERYONE,
588+
),
589+
'direct_message_permission_group': PermissionSettingsItem(
590+
// allow_nobody_group=True,
591+
allowEveryoneGroup: true,
592+
// default_group_name=SystemGroups.EVERYONE,
593+
),
594+
},
429595
group: {}, // Please go ahead and fill this in when we come to need it.
430596
stream: {
431597
// From the server's Stream.stream_permission_group_settings,

lib/api/model/initial_snapshot.g.dart

Lines changed: 27 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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,12 @@ class ZulipStream {
627627

628628
final int streamId;
629629
String name;
630+
631+
// Servers that don't send this property will only send non-archived channels;
632+
// default to false for those servers.
633+
@JsonKey(defaultValue: false)
634+
bool isArchived; // TODO(server-10) remove default and its comment
635+
630636
String description;
631637
String renderedDescription;
632638

@@ -642,6 +648,8 @@ class ZulipStream {
642648
// final bool isAnnouncementOnly; // deprecated for `channelPostPolicy`; ignore
643649

644650
GroupSettingValue? canAddSubscribersGroup; // TODO(server-10)
651+
GroupSettingValue? canDeleteAnyMessageGroup; // TODO(server-11)
652+
GroupSettingValue? canDeleteOwnMessageGroup; // TODO(server-11)
645653
GroupSettingValue? canSubscribeGroup; // TODO(server-10)
646654

647655
// TODO(server-8): added in FL 199, was previously only on [Subscription] objects
@@ -650,6 +658,7 @@ class ZulipStream {
650658
ZulipStream({
651659
required this.streamId,
652660
required this.name,
661+
required this.isArchived,
653662
required this.description,
654663
required this.renderedDescription,
655664
required this.dateCreated,
@@ -660,6 +669,8 @@ class ZulipStream {
660669
required this.messageRetentionDays,
661670
required this.channelPostPolicy,
662671
required this.canAddSubscribersGroup,
672+
required this.canDeleteAnyMessageGroup,
673+
required this.canDeleteOwnMessageGroup,
663674
required this.canSubscribeGroup,
664675
required this.streamWeeklyTraffic,
665676
});
@@ -670,6 +681,7 @@ class ZulipStream {
670681
streamId: subscription.streamId,
671682
name: subscription.name,
672683
description: subscription.description,
684+
isArchived: subscription.isArchived,
673685
renderedDescription: subscription.renderedDescription,
674686
dateCreated: subscription.dateCreated,
675687
firstMessageId: subscription.firstMessageId,
@@ -679,6 +691,8 @@ class ZulipStream {
679691
messageRetentionDays: subscription.messageRetentionDays,
680692
channelPostPolicy: subscription.channelPostPolicy,
681693
canAddSubscribersGroup: subscription.canAddSubscribersGroup,
694+
canDeleteAnyMessageGroup: subscription.canDeleteAnyMessageGroup,
695+
canDeleteOwnMessageGroup: subscription.canDeleteOwnMessageGroup,
682696
canSubscribeGroup: subscription.canSubscribeGroup,
683697
streamWeeklyTraffic: subscription.streamWeeklyTraffic,
684698
);
@@ -700,6 +714,7 @@ class ZulipStream {
700714
enum ChannelPropertyName {
701715
// streamId is immutable
702716
name,
717+
isArchived,
703718
description,
704719
// renderedDescription is updated via its own [ChannelUpdateEvent] field
705720
// dateCreated is immutable
@@ -711,6 +726,8 @@ enum ChannelPropertyName {
711726
@JsonValue('stream_post_policy')
712727
channelPostPolicy,
713728
canAddSubscribersGroup,
729+
canDeleteAnyMessageGroup,
730+
canDeleteOwnMessageGroup,
714731
canSubscribeGroup,
715732
streamWeeklyTraffic;
716733

@@ -783,6 +800,7 @@ class Subscription extends ZulipStream {
783800
required super.streamId,
784801
required super.name,
785802
required super.description,
803+
required super.isArchived,
786804
required super.renderedDescription,
787805
required super.dateCreated,
788806
required super.firstMessageId,
@@ -792,6 +810,8 @@ class Subscription extends ZulipStream {
792810
required super.messageRetentionDays,
793811
required super.channelPostPolicy,
794812
required super.canAddSubscribersGroup,
813+
required super.canDeleteAnyMessageGroup,
814+
required super.canDeleteOwnMessageGroup,
795815
required super.canSubscribeGroup,
796816
required super.streamWeeklyTraffic,
797817
required this.desktopNotifications,

0 commit comments

Comments
 (0)