File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -376,6 +376,19 @@ class ZulipStream {
376376 _$ZulipStreamFromJson (json);
377377
378378 Map <String , dynamic > toJson () => _$ZulipStreamToJson (this );
379+
380+ bool hasPostingPermission (User user, {required int realmWaitingPeriodThreshold}) {
381+ final role = user.role;
382+ return switch (channelPostPolicy) {
383+ ChannelPostPolicy .any => true ,
384+ ChannelPostPolicy .fullMembers => role != UserRole .guest && (role == UserRole .member
385+ ? user.isFullMember (realmWaitingPeriodThreshold)
386+ : true ),
387+ ChannelPostPolicy .moderators => role != UserRole .guest && role != UserRole .member,
388+ ChannelPostPolicy .administrators => role == UserRole .administrator || role == UserRole .owner || role == UserRole .unknown,
389+ ChannelPostPolicy .unknown => true ,
390+ };
391+ }
379392}
380393
381394/// Policy for which users can post to the stream.
You can’t perform that action at this time.
0 commit comments