org settings: Rename plan_includes_wide_organization_logo to more generic.

It's a preliminary step to enable message_retention_setting in org settings
UI, which is a non-limited plan only feature. So we require a page_param
property that tells us the limited-plan state of the Zulip realm.
This commit is contained in:
Pragati Agrawal 2020-05-08 17:00:34 +05:30 committed by Tim Abbott
parent b0466cfd67
commit 12504075ee
7 changed files with 9 additions and 9 deletions

View File

@ -75,7 +75,7 @@ exports.build_page = function () {
realm_digest_weekday: page_params.realm_digest_weekday,
show_email: settings_data.show_email(),
development: page_params.development_environment,
plan_includes_wide_organization_logo: page_params.plan_includes_wide_organization_logo,
zulip_plan_is_not_limited: page_params.zulip_plan_is_not_limited,
upgrade_text_for_wide_organization_logo:
page_params.upgrade_text_for_wide_organization_logo,
realm_default_external_accounts: page_params.realm_default_external_accounts,

View File

@ -989,7 +989,7 @@ exports.build_page = function () {
});
}
if (page_params.plan_includes_wide_organization_logo) {
if (page_params.zulip_plan_is_not_limited) {
realm_logo.build_realm_logo_widget(upload_realm_logo, false);
realm_logo.build_realm_logo_widget(upload_realm_logo, true);
}

View File

@ -7,7 +7,7 @@
{{#if is_admin}}
<div class="inline-block avatar-controls">
<div class="realm-logo-file-input-error alert text-error"></div>
{{#if plan_includes_wide_organization_logo}}
{{#if zulip_plan_is_not_limited}}
<button class="realm-logo-upload-button button rounded sea-green w-200 block input-size {{theme_mode}}-settings">
<span class="upload-logo-button-text">{{t 'Upload new logo' }}</span>
<span class="upload-logo-spinner"></span>

View File

@ -1,5 +1,5 @@
<div>
{{#unless plan_includes_wide_organization_logo}}
{{#unless zulip_plan_is_not_limited}}
<a href="/upgrade" class="upgrade-tip" target="_blank">
{{upgrade_text_for_wide_organization_logo}}
</a>

View File

@ -167,7 +167,7 @@ def fetch_initial_state_data(user_profile: UserProfile,
state['realm_push_notifications_enabled'] = push_notifications_enabled()
state['realm_upload_quota'] = realm.upload_quota_bytes()
state['realm_plan_type'] = realm.plan_type
state['plan_includes_wide_organization_logo'] = realm.plan_type != Realm.LIMITED
state['zulip_plan_is_not_limited'] = realm.plan_type != Realm.LIMITED
state['upgrade_text_for_wide_organization_logo'] = str(Realm.UPGRADE_TEXT_STANDARD)
state['realm_default_external_accounts'] = DEFAULT_EXTERNAL_ACCOUNTS
@ -526,7 +526,7 @@ def apply_event(state: Dict[str, Any],
if event['property'] == 'plan_type':
# Then there are some extra fields that also need to be set.
state['plan_includes_wide_organization_logo'] = event['value'] != Realm.LIMITED
state['zulip_plan_is_not_limited'] = event['value'] != Realm.LIMITED
state['realm_upload_quota'] = event['extra_data']['upload_quota']
policy_permission_dict = {'create_stream_policy': 'can_create_streams',

View File

@ -1990,7 +1990,7 @@ class EventsRegisterTest(ZulipTestCase):
state_data = fetch_initial_state_data(self.user_profile, None, "", False)
self.assertEqual(state_data['realm_plan_type'], Realm.SELF_HOSTED)
self.assertEqual(state_data['plan_includes_wide_organization_logo'], True)
self.assertEqual(state_data['zulip_plan_is_not_limited'], True)
schema_checker = self.check_events_dict([
('type', equals('realm')),
@ -2007,7 +2007,7 @@ class EventsRegisterTest(ZulipTestCase):
state_data = fetch_initial_state_data(self.user_profile, None, "", False)
self.assertEqual(state_data['realm_plan_type'], Realm.LIMITED)
self.assertEqual(state_data['plan_includes_wide_organization_logo'], False)
self.assertEqual(state_data['zulip_plan_is_not_limited'], False)
def test_realm_emoji_events(self) -> None:
schema_checker = self.check_events_dict([

View File

@ -115,7 +115,6 @@ class HomeTest(ZulipTestCase):
"notification_sound",
"password_min_guesses",
"password_min_length",
"plan_includes_wide_organization_logo",
"pm_content_in_desktop_notifications",
"pointer",
"poll_timeout",
@ -226,6 +225,7 @@ class HomeTest(ZulipTestCase):
"webpack_public_path",
"wildcard_mentions_notify",
"zulip_feature_level",
"zulip_plan_is_not_limited",
"zulip_version",
]