File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -649,7 +649,7 @@ class ZulipStream {
649
649
bool historyPublicToSubscribers;
650
650
int ? messageRetentionDays;
651
651
@JsonKey (name: 'stream_post_policy' )
652
- ChannelPostPolicy channelPostPolicy;
652
+ ChannelPostPolicy ? channelPostPolicy; // TODO(server-10) remove
653
653
// final bool isAnnouncementOnly; // deprecated for `channelPostPolicy`; ignore
654
654
655
655
GroupSettingValue ? canAddSubscribersGroup; // TODO(server-10)
Original file line number Diff line number Diff line change @@ -198,21 +198,25 @@ mixin ChannelStore on UserStore {
198
198
if (inChannel.canSendMessageGroup != null ) {
199
199
return selfHasPermissionForGroupSetting (inChannel.canSendMessageGroup! ,
200
200
GroupSettingType .stream, 'can_send_message_group' );
201
- } else {
201
+ } else if (inChannel.channelPostPolicy != null ) {
202
202
return _selfPassesLegacyChannelPostPolicy (inChannel: inChannel, atDate: byDate);
203
+ } else {
204
+ assert (false ); // TODO(log)
205
+ return true ;
203
206
}
204
207
}
205
208
206
209
bool _selfPassesLegacyChannelPostPolicy ({
207
210
required ZulipStream inChannel,
208
211
required DateTime atDate,
209
212
}) {
213
+ assert (inChannel.channelPostPolicy != null );
210
214
final role = selfUser.role;
211
215
// We let the users with [unknown] role to send the message, then the server
212
216
// will decide to accept it or not based on its actual role.
213
217
if (role == UserRole .unknown) return true ;
214
218
215
- switch (inChannel.channelPostPolicy) {
219
+ switch (inChannel.channelPostPolicy! ) {
216
220
case ChannelPostPolicy .any: return true ;
217
221
case ChannelPostPolicy .fullMembers: {
218
222
if (! role.isAtLeast (UserRole .member)) return false ;
You can’t perform that action at this time.
0 commit comments