-
Notifications
You must be signed in to change notification settings - Fork 343
Channel link autocomplete #1902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
05c8437
5a6b96a
607dc8b
c9d282e
c5f6c77
a459122
42fa913
650eed5
a1c4721
c584d1b
f2fc65c
5072dce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -616,9 +616,14 @@ class ChannelDeleteEvent extends ChannelEvent { | |
| @JsonKey(includeToJson: true) | ||
| String get op => 'delete'; | ||
|
|
||
| final List<ZulipStream> streams; | ||
| final List<ZulipStreamId>? streams; // TODO(server-10): remove | ||
| final List<int>? streamIds; // TODO(server-10): remove nullability | ||
|
|
||
| ChannelDeleteEvent({required super.id, required this.streams}); | ||
| ChannelDeleteEvent({ | ||
| required super.id, | ||
| required this.streams, | ||
| required this.streamIds, | ||
| }) : assert(streams != null || streamIds != null); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We try to reserve Also, |
||
|
|
||
| factory ChannelDeleteEvent.fromJson(Map<String, dynamic> json) => | ||
| _$ChannelDeleteEventFromJson(json); | ||
|
|
@@ -627,6 +632,18 @@ class ChannelDeleteEvent extends ChannelEvent { | |
| Map<String, dynamic> toJson() => _$ChannelDeleteEventToJson(this); | ||
| } | ||
|
|
||
| @JsonSerializable(fieldRename: FieldRename.snake) | ||
| class ZulipStreamId { | ||
| final int streamId; | ||
|
|
||
| ZulipStreamId({required this.streamId}); | ||
|
|
||
| factory ZulipStreamId.fromJson(Map<String, dynamic> json) => | ||
| _$ZulipStreamIdFromJson(json); | ||
|
|
||
| Map<String, dynamic> toJson() => _$ZulipStreamIdToJson(this); | ||
| } | ||
|
|
||
| /// A [ChannelEvent] with op `update`: https://zulip.com/api/get-events#stream-update | ||
| @JsonSerializable(fieldRename: FieldRename.snake) | ||
| class ChannelUpdateEvent extends ChannelEvent { | ||
|
|
@@ -683,6 +700,8 @@ class ChannelUpdateEvent extends ChannelEvent { | |
| return value as int?; | ||
| case ChannelPropertyName.channelPostPolicy: | ||
| return ChannelPostPolicy.fromApiValue(value as int); | ||
| case ChannelPropertyName.isRecentlyActive: | ||
| return value as bool?; | ||
| case ChannelPropertyName.folderId: | ||
| return value as int?; | ||
| case ChannelPropertyName.canAddSubscribersGroup: | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -652,6 +652,7 @@ class ZulipStream { | |
| @JsonKey(name: 'stream_post_policy') | ||
| ChannelPostPolicy? channelPostPolicy; // TODO(server-10) remove | ||
| // final bool isAnnouncementOnly; // deprecated for `channelPostPolicy`; ignore | ||
| bool? isRecentlyActive; // TODO(server-10) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we're already not matching the order in the API doc (see e.g. #1894 (comment) ), I'd put this next to the related-looking field Similarly elsewhere in this commit. |
||
|
|
||
| GroupSettingValue? canAddSubscribersGroup; // TODO(server-10) | ||
| GroupSettingValue? canDeleteAnyMessageGroup; // TODO(server-11) | ||
|
|
@@ -675,6 +676,7 @@ class ZulipStream { | |
| required this.historyPublicToSubscribers, | ||
| required this.messageRetentionDays, | ||
| required this.channelPostPolicy, | ||
| required this.isRecentlyActive, | ||
| required this.folderId, | ||
| required this.canAddSubscribersGroup, | ||
| required this.canDeleteAnyMessageGroup, | ||
|
|
@@ -699,6 +701,7 @@ class ZulipStream { | |
| historyPublicToSubscribers: subscription.historyPublicToSubscribers, | ||
| messageRetentionDays: subscription.messageRetentionDays, | ||
| channelPostPolicy: subscription.channelPostPolicy, | ||
| isRecentlyActive: subscription.isRecentlyActive, | ||
| folderId: subscription.folderId, | ||
| canAddSubscribersGroup: subscription.canAddSubscribersGroup, | ||
| canDeleteAnyMessageGroup: subscription.canDeleteAnyMessageGroup, | ||
|
|
@@ -736,6 +739,7 @@ enum ChannelPropertyName { | |
| messageRetentionDays, | ||
| @JsonValue('stream_post_policy') | ||
| channelPostPolicy, | ||
| isRecentlyActive, | ||
| folderId, | ||
| canAddSubscribersGroup, | ||
| canDeleteAnyMessageGroup, | ||
|
|
@@ -821,6 +825,7 @@ class Subscription extends ZulipStream { | |
| required super.historyPublicToSubscribers, | ||
| required super.messageRetentionDays, | ||
| required super.channelPostPolicy, | ||
| required super.isRecentlyActive, | ||
| required super.folderId, | ||
| required super.canAddSubscribersGroup, | ||
| required super.canDeleteAnyMessageGroup, | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,3 +66,6 @@ class OptionSome<T> extends Option<T> { | |
| @override | ||
| String toString() => 'OptionSome($value)'; | ||
| } | ||
|
|
||
| /// Returns [object] as [T] if it matches the type, otherwise `null`. | ||
| T? tryCast<T>(dynamic object) => object is T ? object : null; | ||
|
Comment on lines
+70
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reading this commit message, I'm wondering whether this will really be preferable to an inline |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we'd normally say
TODO(server-10) make requiredor justTODO(server-10).