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 {
649649 bool historyPublicToSubscribers;
650650 int ? messageRetentionDays;
651651 @JsonKey (name: 'stream_post_policy' )
652- ChannelPostPolicy channelPostPolicy;
652+ ChannelPostPolicy ? channelPostPolicy; // TODO(server-10) remove
653653 // final bool isAnnouncementOnly; // deprecated for `channelPostPolicy`; ignore
654654
655655 GroupSettingValue ? canAddSubscribersGroup; // TODO(server-10)
Original file line number Diff line number Diff line change @@ -198,21 +198,25 @@ mixin ChannelStore on UserStore {
198198 if (inChannel.canSendMessageGroup != null ) {
199199 return selfHasPermissionForGroupSetting (inChannel.canSendMessageGroup! ,
200200 GroupSettingType .stream, 'can_send_message_group' );
201- } else {
201+ } else if (inChannel.channelPostPolicy != null ) {
202202 return _selfPassesLegacyChannelPostPolicy (inChannel: inChannel, atDate: byDate);
203+ } else {
204+ assert (false ); // TODO(log)
205+ return true ;
203206 }
204207 }
205208
206209 bool _selfPassesLegacyChannelPostPolicy ({
207210 required ZulipStream inChannel,
208211 required DateTime atDate,
209212 }) {
213+ assert (inChannel.channelPostPolicy != null );
210214 final role = selfUser.role;
211215 // We let the users with [unknown] role to send the message, then the server
212216 // will decide to accept it or not based on its actual role.
213217 if (role == UserRole .unknown) return true ;
214218
215- switch (inChannel.channelPostPolicy) {
219+ switch (inChannel.channelPostPolicy! ) {
216220 case ChannelPostPolicy .any: return true ;
217221 case ChannelPostPolicy .fullMembers: {
218222 if (! role.isAtLeast (UserRole .member)) return false ;
You can’t perform that action at this time.
0 commit comments