stream: Rename can_subscribe_others_to_all_streams.

Rename `can_subscribe_others_to_all_streams` to
`can_subscribe_others_to_all_accessible_streams` so it's clear that we
are not attempting to check basic access in this function.
This commit is contained in:
Shubham Padia
2025-01-23 14:37:22 +00:00
committed by Tim Abbott
parent 32f9ee7a62
commit e912ada51e
6 changed files with 6 additions and 6 deletions

View File

@@ -90,7 +90,7 @@ export function user_can_create_multiuse_invite(): boolean {
);
}
export function can_subscribe_others_to_all_streams(): boolean {
export function can_subscribe_others_to_all_accessible_streams(): boolean {
return user_has_permission_for_group_setting(
realm.realm_can_add_subscribers_group,
"can_add_subscribers_group",

View File

@@ -546,7 +546,7 @@ export function can_subscribe_others(sub: StreamSubscription): boolean {
return false;
}
if (settings_data.can_subscribe_others_to_all_streams()) {
if (settings_data.can_subscribe_others_to_all_accessible_streams()) {
return true;
}

View File

@@ -434,7 +434,7 @@ export function update_add_subscriptions_elements(sub: SettingsSubscription): vo
if (!allow_user_to_add_subs) {
let tooltip_message;
if (!settings_data.can_subscribe_others_to_all_streams()) {
if (!settings_data.can_subscribe_others_to_all_accessible_streams()) {
tooltip_message = $t({
defaultMessage:
"You do not have permission to add other users to channels in this organization.",

View File

@@ -183,7 +183,7 @@ test_realm_group_settings(
test_realm_group_settings(
"realm_can_add_subscribers_group",
settings_data.can_subscribe_others_to_all_streams,
settings_data.can_subscribe_others_to_all_accessible_streams,
);
test_realm_group_settings(

View File

@@ -789,7 +789,7 @@ def get_streams_to_which_user_cannot_add_subscribers(
# does not waste database queries re-checking that.
result: list[Stream] = []
if user_profile.can_subscribe_others_to_all_streams():
if user_profile.can_subscribe_others_to_all_accessible_streams():
return []
# Optimization for the organization administrator code path. We

View File

@@ -844,7 +844,7 @@ class UserProfile(AbstractBaseUser, PermissionsMixin, UserBaseSettings):
def can_manage_default_streams(self) -> bool:
return self.is_realm_admin
def can_subscribe_others_to_all_streams(self) -> bool:
def can_subscribe_others_to_all_accessible_streams(self) -> bool:
return self.has_permission("can_add_subscribers_group")
def can_invite_users_by_email(self, realm: Optional["Realm"] = None) -> bool: