Skip to content

api: Rename to ChannelDestination and ChannelPostPolicy from "stream" #846

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

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/api/model/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,9 @@ class ZulipStream {
final bool isWebPublic; // present since 2.1, according to /api/changelog
final bool historyPublicToSubscribers;
final int? messageRetentionDays;

final StreamPostPolicy streamPostPolicy;
// final bool isAnnouncementOnly; // deprecated for `streamPostPolicy`; ignore
@JsonKey(name: 'stream_post_policy')
final ChannelPostPolicy channelPostPolicy;
// final bool isAnnouncementOnly; // deprecated for `channelPostPolicy`; ignore

// TODO(server-6): `canRemoveSubscribersGroupId` added in FL 142
// TODO(server-8): in FL 197 renamed to `canRemoveSubscribersGroup`
Expand All @@ -348,7 +348,7 @@ class ZulipStream {
required this.isWebPublic,
required this.historyPublicToSubscribers,
required this.messageRetentionDays,
required this.streamPostPolicy,
required this.channelPostPolicy,
required this.canRemoveSubscribersGroup,
required this.streamWeeklyTraffic,
});
Expand All @@ -364,14 +364,14 @@ class ZulipStream {
/// For docs, search for "stream_post_policy"
/// in <https://zulip.com/api/get-stream-by-id>
@JsonEnum(valueField: 'apiValue')
enum StreamPostPolicy {
enum ChannelPostPolicy {
any(apiValue: 1),
administrators(apiValue: 2),
fullMembers(apiValue: 3),
moderators(apiValue: 4),
unknown(apiValue: null);

const StreamPostPolicy({
const ChannelPostPolicy({
required this.apiValue,
});

Expand Down Expand Up @@ -419,7 +419,7 @@ class Subscription extends ZulipStream {
required super.isWebPublic,
required super.historyPublicToSubscribers,
required super.messageRetentionDays,
required super.streamPostPolicy,
required super.channelPostPolicy,
required super.canRemoveSubscribersGroup,
required super.streamWeeklyTraffic,
required this.desktopNotifications,
Expand Down
24 changes: 12 additions & 12 deletions lib/api/model/model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/api/model/model_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void main() {
'is_web_public': false,
'history_public_to_subscribers': true,
'message_retention_days': null,
'stream_post_policy': StreamPostPolicy.any.apiValue,
'stream_post_policy': ChannelPostPolicy.any.apiValue,
// 'can_remove_subscribers_group': null,
'stream_weekly_traffic': null,
});
Expand Down
6 changes: 3 additions & 3 deletions test/example_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ ZulipStream stream({
bool? isWebPublic,
bool? historyPublicToSubscribers,
int? messageRetentionDays,
StreamPostPolicy? streamPostPolicy,
ChannelPostPolicy? channelPostPolicy,
int? canRemoveSubscribersGroup,
int? streamWeeklyTraffic,
}) {
Expand All @@ -186,7 +186,7 @@ ZulipStream stream({
isWebPublic: isWebPublic ?? false,
historyPublicToSubscribers: historyPublicToSubscribers ?? true,
messageRetentionDays: messageRetentionDays,
streamPostPolicy: streamPostPolicy ?? StreamPostPolicy.any,
channelPostPolicy: channelPostPolicy ?? ChannelPostPolicy.any,
canRemoveSubscribersGroup: canRemoveSubscribersGroup ?? 123,
streamWeeklyTraffic: streamWeeklyTraffic,
);
Expand Down Expand Up @@ -219,7 +219,7 @@ Subscription subscription(
isWebPublic: stream.isWebPublic,
historyPublicToSubscribers: stream.historyPublicToSubscribers,
messageRetentionDays: stream.messageRetentionDays,
streamPostPolicy: stream.streamPostPolicy,
channelPostPolicy: stream.channelPostPolicy,
canRemoveSubscribersGroup: stream.canRemoveSubscribersGroup,
streamWeeklyTraffic: stream.streamWeeklyTraffic,
desktopNotifications: desktopNotifications ?? false,
Expand Down