File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -140,12 +140,19 @@ mixin ChannelStore on UserStore {
140140 }
141141 }
142142
143- bool selfCanSubscribe (int channelId) {
144- // Compare web's stream_data.has_content_access_via_group_permissions.
143+ bool selfHasContentAccess (ZulipStream channel) {
144+ // Compare web's stream_data.has_content_access.
145+ if (channel.isWebPublic) return true ;
146+ if (channel is Subscription ) return true ;
147+ // Here web calls has_metadata_access... but that always returns true,
148+ // as its comment says.
145149 if (selfUser.role == UserRole .guest) return false ;
146- final channel = streams[channelId];
147- if (channel == null ) return false ;
148150 if (! channel.inviteOnly) return true ;
151+ return _selfHasContentAccessViaGroupPermissions (channel);
152+ }
153+
154+ bool _selfHasContentAccessViaGroupPermissions (ZulipStream channel) {
155+ // Compare web's stream_data.has_content_access_via_group_permissions.
149156 return selfHasPermissionForGroupSetting (channel.canAddSubscribersGroup,
150157 GroupSettingType .group, 'can_add_subscribers_group' )
151158 || selfHasPermissionForGroupSetting (channel.canSubscribeGroup,
You can’t perform that action at this time.
0 commit comments