Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

settings_data: Rename user_can_subscribe_other_users.

Shubham Padia2ccfe36f01b6
diff --git a/web/src/compose_validate.ts b/web/src/compose_validate.ts
index d3dac42cafd..dd13d164b37 100644
--- a/web/src/compose_validate.ts
+++ b/web/src/compose_validate.ts
@@ -281,7 +281,7 @@ export function warn_if_mentioning_unsubscribed_user(
Number($(user_row).attr("data-user-id")),
);
- const can_subscribe_other_users = settings_data.user_can_subscribe_other_users();
+ const can_subscribe_other_users = settings_data.can_subscribe_others_to_all_streams();
if (!existing_invites.includes(user_id)) {
const context = {
diff --git a/web/src/invite.ts b/web/src/invite.ts
index c6276e3796b..bd506154df5 100644
--- a/web/src/invite.ts
+++ b/web/src/invite.ts
@@ -84,7 +84,7 @@ function get_common_invitation_data(): {
let include_realm_default_subscriptions = false;
if (
$("#invite_select_default_streams").prop("checked") ||
- !settings_data.user_can_subscribe_other_users()
+ !settings_data.can_subscribe_others_to_all_streams()
) {
include_realm_default_subscriptions = true;
} else {
@@ -389,7 +389,7 @@ function open_invite_user_modal(e: JQuery.ClickEvent<Document, undefined>): void
time_choices: settings_config.custom_time_unit_values,
show_select_default_streams_option: stream_data.get_default_stream_ids().length > 0,
user_has_email_set: !settings_data.user_email_not_configured(),
- can_subscribe_other_users: settings_data.user_can_subscribe_other_users(),
+ can_subscribe_other_users: settings_data.can_subscribe_others_to_all_streams(),
});
function invite_user_modal_post_render(): void {
@@ -414,7 +414,7 @@ function open_invite_user_modal(e: JQuery.ClickEvent<Document, undefined>): void
const valid_to_text = valid_to();
settings_components.set_time_input_formatted_text($expires_in, valid_to_text);
- if (settings_data.user_can_subscribe_other_users()) {
+ if (settings_data.can_subscribe_others_to_all_streams()) {
set_streams_to_join_list_visibility();
const $stream_pill_container = $("#invite_streams_container .pill-container");
stream_pill_widget = invite_stream_picker_pill.create($stream_pill_container);
diff --git a/web/src/settings_data.ts b/web/src/settings_data.ts
index 94e4cc756a9..ad18d5493b7 100644
--- a/web/src/settings_data.ts
+++ b/web/src/settings_data.ts
@@ -90,7 +90,7 @@ export function user_can_create_multiuse_invite(): boolean {
);
}
-export function user_can_subscribe_other_users(): boolean {
+export function can_subscribe_others_to_all_streams(): boolean {
return user_has_permission_for_group_setting(
realm.realm_can_add_subscribers_group,
"can_add_subscribers_group",
diff --git a/web/src/stream_create.ts b/web/src/stream_create.ts
index d378216073a..4f0ad91f8ce 100644
--- a/web/src/stream_create.ts
+++ b/web/src/stream_create.ts
@@ -514,7 +514,7 @@ export function show_new_stream_modal(): void {
stream_ui_updates.enable_or_disable_add_subscribers_elements(
$add_subscribers_container,
- settings_data.user_can_subscribe_other_users(),
+ settings_data.can_subscribe_others_to_all_streams(),
true,
);
diff --git a/web/src/stream_data.ts b/web/src/stream_data.ts
index 0584962e77a..337ac6642c6 100644
--- a/web/src/stream_data.ts
+++ b/web/src/stream_data.ts
@@ -547,7 +547,7 @@ export function can_subscribe_others(sub: StreamSubscription): boolean {
return (
!current_user.is_guest &&
(!sub.invite_only || sub.subscribed) &&
- settings_data.user_can_subscribe_other_users()
+ settings_data.can_subscribe_others_to_all_streams()
);
}
diff --git a/web/src/stream_ui_updates.ts b/web/src/stream_ui_updates.ts
index 9eea069c608..fe52dc3a800 100644
--- a/web/src/stream_ui_updates.ts
+++ b/web/src/stream_ui_updates.ts
@@ -422,7 +422,7 @@ export function update_add_subscriptions_elements(sub: SettingsSubscription): vo
if (!allow_user_to_add_subs) {
let tooltip_message;
- if (!settings_data.user_can_subscribe_other_users()) {
+ if (!settings_data.can_subscribe_others_to_all_streams()) {
tooltip_message = $t({
defaultMessage:
"You do not have permission to add other users to channels in this organization.",
diff --git a/web/src/user_profile.ts b/web/src/user_profile.ts
index 79ef9b71f27..71478525279 100644
--- a/web/src/user_profile.ts
+++ b/web/src/user_profile.ts
@@ -542,7 +542,7 @@ export function show_user_profile(user: User, default_tab_key = "profile-tab"):
// want to show the subscribe widget for generic bots since they are system bots and for deactivated users.
// Therefore, we also check for that condition.
const show_user_subscribe_widget =
- (people.can_admin_user(user) || settings_data.user_can_subscribe_other_users()) &&
+ (people.can_admin_user(user) || settings_data.can_subscribe_others_to_all_streams()) &&
!user.is_system_bot &&
people.is_person_active(user.user_id);
// We currently have the main UI for editing your own profile in
diff --git a/web/tests/settings_data.test.cjs b/web/tests/settings_data.test.cjs
index a0001e7191e..82f30325bcf 100644
--- a/web/tests/settings_data.test.cjs
+++ b/web/tests/settings_data.test.cjs
@@ -183,7 +183,7 @@ test_realm_group_settings(
test_realm_group_settings(
"realm_can_add_subscribers_group",
- settings_data.user_can_subscribe_other_users,
+ settings_data.can_subscribe_others_to_all_streams,
);
test_realm_group_settings(