mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
settings_config: Fix hardcoded numbers for plan_type and org_type.
This commit is contained in:
@@ -258,7 +258,8 @@ export function build_page(): void {
|
||||
...get_realm_level_notification_settings(),
|
||||
group_setting_labels: settings_config.all_group_setting_labels.realm,
|
||||
server_can_summarize_topics: realm.server_can_summarize_topics,
|
||||
is_plan_self_hosted: realm.realm_plan_type === 1,
|
||||
is_plan_self_hosted:
|
||||
realm.realm_plan_type === settings_config.realm_plan_types.self_hosted.code,
|
||||
has_billing_access: settings_data.user_has_billing_access(),
|
||||
};
|
||||
|
||||
@@ -277,8 +278,9 @@ export function build_page(): void {
|
||||
|
||||
$("#id_realm_digest_weekday").val(realm.realm_digest_weekday);
|
||||
|
||||
const is_plan_plus = realm.realm_plan_type === 10;
|
||||
const is_plan_self_hosted = realm.realm_plan_type === 1;
|
||||
const is_plan_plus = realm.realm_plan_type === settings_config.realm_plan_types.plus.code;
|
||||
const is_plan_self_hosted =
|
||||
realm.realm_plan_type === settings_config.realm_plan_types.self_hosted.code;
|
||||
if (current_user.is_admin && !(is_plan_plus || is_plan_self_hosted)) {
|
||||
$("#realm_can_access_all_users_group_widget").prop("disabled", true);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import * as ListWidget from "./list_widget.ts";
|
||||
import * as loading from "./loading.ts";
|
||||
import * as scroll_util from "./scroll_util.ts";
|
||||
import {message_edit_history_visibility_policy_values} from "./settings_config.ts";
|
||||
import * as settings_config from "./settings_config.ts";
|
||||
import {current_user, realm} from "./state_data.ts";
|
||||
import * as timerender from "./timerender.ts";
|
||||
import * as ui_report from "./ui_report.ts";
|
||||
@@ -73,7 +74,8 @@ function set_upload_space_stats(): void {
|
||||
return;
|
||||
}
|
||||
const args = {
|
||||
show_upgrade_message: realm.realm_plan_type === 2,
|
||||
show_upgrade_message:
|
||||
realm.realm_plan_type === settings_config.realm_plan_types.limited.code,
|
||||
upload_quota_string: $t(
|
||||
{
|
||||
defaultMessage:
|
||||
|
||||
@@ -350,8 +350,9 @@ function get_billing_info(): BillingInfo {
|
||||
return billing_info;
|
||||
}
|
||||
|
||||
const is_plan_standard = realm.realm_plan_type === 3;
|
||||
const is_plan_plus = realm.realm_plan_type === 10;
|
||||
const is_plan_standard =
|
||||
realm.realm_plan_type === settings_config.realm_plan_types.standard.code;
|
||||
const is_plan_plus = realm.realm_plan_type === settings_config.realm_plan_types.plus.code;
|
||||
const is_org_on_paid_plan = is_plan_standard || is_plan_plus;
|
||||
|
||||
billing_info.show_remote_billing = !page_params.corporate_enabled;
|
||||
@@ -363,8 +364,9 @@ function get_billing_info(): BillingInfo {
|
||||
|
||||
export function get_gear_menu_content_context(): GearMenuContext {
|
||||
const user_has_billing_access = settings_data.user_has_billing_access();
|
||||
const is_plan_standard = realm.realm_plan_type === 3;
|
||||
const is_plan_plus = realm.realm_plan_type === 10;
|
||||
const is_plan_standard =
|
||||
realm.realm_plan_type === settings_config.realm_plan_types.standard.code;
|
||||
const is_plan_plus = realm.realm_plan_type === settings_config.realm_plan_types.plus.code;
|
||||
const is_org_on_paid_plan = is_plan_standard || is_plan_plus;
|
||||
const billing_info = get_billing_info();
|
||||
return {
|
||||
@@ -373,15 +375,18 @@ export function get_gear_menu_content_context(): GearMenuContext {
|
||||
is_owner: current_user.is_owner,
|
||||
is_admin: current_user.is_admin,
|
||||
is_spectator: page_params.is_spectator,
|
||||
is_self_hosted: realm.realm_plan_type === 1,
|
||||
is_self_hosted: realm.realm_plan_type === settings_config.realm_plan_types.self_hosted.code,
|
||||
is_development_environment: page_params.development_environment,
|
||||
is_plan_limited: realm.realm_plan_type === 2,
|
||||
is_plan_limited: realm.realm_plan_type === settings_config.realm_plan_types.limited.code,
|
||||
is_plan_standard,
|
||||
is_plan_standard_sponsored_for_free: realm.realm_plan_type === 4,
|
||||
is_plan_standard_sponsored_for_free:
|
||||
realm.realm_plan_type === settings_config.realm_plan_types.standard_free.code,
|
||||
is_plan_plus,
|
||||
is_org_on_paid_plan,
|
||||
is_business_org: realm.realm_org_type === 10,
|
||||
is_education_org: realm.realm_org_type === 30 || realm.realm_org_type === 35,
|
||||
is_business_org: realm.realm_org_type === settings_config.all_org_type_values.business.code,
|
||||
is_education_org:
|
||||
realm.realm_org_type === settings_config.all_org_type_values.education_nonprofit.code ||
|
||||
realm.realm_org_type === settings_config.all_org_type_values.education.code,
|
||||
standard_plan_name: "Zulip Cloud Standard",
|
||||
server_needs_upgrade: realm.server_needs_upgrade,
|
||||
version_display_string: gear_menu_util.version_display_string(),
|
||||
|
||||
@@ -1230,3 +1230,11 @@ export const bot_type_values = {
|
||||
name: $t({defaultMessage: "Embedded bot"}),
|
||||
},
|
||||
};
|
||||
|
||||
export const realm_plan_types = {
|
||||
self_hosted: {code: 1},
|
||||
limited: {code: 2},
|
||||
standard: {code: 3},
|
||||
standard_free: {code: 4},
|
||||
plus: {code: 10},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user