-
Notifications
You must be signed in to change notification settings - Fork 348
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
d86207f
8b88703
82eb4f0
826f696
d2dc725
4456cb0
e0774a7
854f58a
c971bb6
1b7a7b5
d1abf20
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,15 +616,38 @@ class ChannelDeleteEvent extends ChannelEvent { | |
| @JsonKey(includeToJson: true) | ||
| String get op => 'delete'; | ||
|
|
||
| final List<ZulipStream> streams; | ||
| @JsonKey(readValue: _readChannelIds, includeToJson: false) | ||
| final List<int> channelIds; | ||
|
|
||
| // TODO(server-10) simplify away; rely on stream_ids | ||
| static List<int> _readChannelIds(Map<dynamic, dynamic> json, String key) { | ||
| final channelIds = json['stream_ids'] as List<dynamic>?; | ||
| if (channelIds != null) channelIds.map((id) => id as int).toList(); | ||
|
|
||
| final channels = json['streams'] as List<dynamic>; | ||
| return channels | ||
| .map((c) => (c as Map<String, dynamic>)['stream_id'] as int) | ||
| .toList(); | ||
| } | ||
|
|
||
| ChannelDeleteEvent({required super.id, required this.streams}); | ||
| ChannelDeleteEvent({ | ||
| required super.id, | ||
| required this.channelIds, | ||
| }); | ||
|
|
||
| factory ChannelDeleteEvent.fromJson(Map<String, dynamic> json) => | ||
| _$ChannelDeleteEventFromJson(json); | ||
|
|
||
| @override | ||
| Map<String, dynamic> toJson() => _$ChannelDeleteEventToJson(this); | ||
| Map<String, dynamic> toJson() { | ||
| // TODO(server-10) simplify away; rely on stream_ids | ||
| final result = _$ChannelDeleteEventToJson(this); | ||
| result['stream_ids'] = channelIds; | ||
| result['streams'] = [ | ||
| for (final id in channelIds) {'stream_id': id} | ||
| ]; | ||
| return result; | ||
| } | ||
| } | ||
|
|
||
| /// A [ChannelEvent] with op `update`: https://zulip.com/api/get-events#stream-update | ||
|
|
@@ -683,6 +706,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?; | ||
|
Comment on lines
+709
to
+710
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. nit: bump on #1902 (comment) |
||
| 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.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Let's link to #api design > stream deletion events @ 💬 in the commit message.
(Also a nit: the symptom is described in that discussion; it's noticeable but it's not as bad as crashing the app.)