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.

register api: Rename realm_upload_quota.

Gaurav Pandey64bd461bad57
diff --git a/static/js/attachments_ui.js b/static/js/attachments_ui.js
index 48eba9c502e..b631fcc0d4b 100644
--- a/static/js/attachments_ui.js
+++ b/static/js/attachments_ui.js
@@ -30,20 +30,20 @@ export function bytes_to_size(bytes, kb_with_1024_bytes = false) {
}
export function percentage_used_space(uploads_size) {
- if (page_params.realm_upload_quota === null) {
+ if (page_params.realm_upload_quota_mib === null) {
return null;
}
- return ((100 * uploads_size) / page_params.realm_upload_quota).toFixed(1);
+ return ((100 * uploads_size) / page_params.realm_upload_quota_mib).toFixed(1);
}
function set_upload_space_stats() {
- if (page_params.realm_upload_quota === null) {
+ if (page_params.realm_upload_quota_mib === null) {
return;
}
const args = {
show_upgrade_message: page_params.realm_plan_type === 2,
percent_used: percentage_used_space(upload_space_used),
- upload_quota: bytes_to_size(page_params.realm_upload_quota, true),
+ upload_quota: bytes_to_size(page_params.realm_upload_quota_mib, true),
};
const rendered_upload_stats_html = render_settings_upload_space_stats(args);
$("#attachment-stats-holder").html(rendered_upload_stats_html);
diff --git a/templates/zerver/api/changelog.md b/templates/zerver/api/changelog.md
index e7738c53c2b..7012edbc80e 100644
--- a/templates/zerver/api/changelog.md
+++ b/templates/zerver/api/changelog.md
@@ -11,6 +11,12 @@ below features are supported.
## Changes in Zulip 5.0
+**Feature level 72**
+
+* [`POST /register`](/api/register-queue): Renamed `max_icon_file_size` to
+ `max_icon_file_size_mib`, `realm_upload_quota` to `realm_upload_quota_mib`
+ and `max_logo_file_size` to `max_logo_file_size_mib`.
+
**Feature level 71**
* [`GET /events`](/api/get-events): Added `is_web_public` field to
diff --git a/version.py b/version.py
index cffc30eccd5..54c4a782f1a 100644
--- a/version.py
+++ b/version.py
@@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.4.3"
# Changes should be accompanied by documentation explaining what the
# new level means in templates/zerver/api/changelog.md, as well as
# "**Changes**" entries in the endpoint's documentation in `zulip.yaml`.
-API_FEATURE_LEVEL = 71
+API_FEATURE_LEVEL = 72
# Bump the minor PROVISION_VERSION to indicate that folks should provision
# only when going from an old version of the code to a newer version. Bump
diff --git a/zerver/lib/events.py b/zerver/lib/events.py
index cb0410ec1c9..98ee8900511 100644
--- a/zerver/lib/events.py
+++ b/zerver/lib/events.py
@@ -244,8 +244,7 @@ def fetch_initial_state_data(
state["max_avatar_file_size_mib"] = settings.MAX_AVATAR_FILE_SIZE
state["max_file_upload_size_mib"] = settings.MAX_FILE_UPLOAD_SIZE
state["max_icon_file_size_mib"] = settings.MAX_ICON_FILE_SIZE
- # TODO: This should have units in its name
- state["realm_upload_quota"] = realm.upload_quota_bytes()
+ state["realm_upload_quota_mib"] = realm.upload_quota_bytes()
state["realm_icon_url"] = realm_icon_url(realm)
state["realm_icon_source"] = realm.icon_source
@@ -807,7 +806,7 @@ def apply_event(
if event["property"] == "plan_type":
# Then there are some extra fields that also need to be set.
state["zulip_plan_is_not_limited"] = event["value"] != Realm.LIMITED
- state["realm_upload_quota"] = event["extra_data"]["upload_quota"]
+ state["realm_upload_quota_mib"] = event["extra_data"]["upload_quota"]
policy_permission_dict = {
"create_stream_policy": "can_create_streams",
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index 3d4870961fb..8bf3b173fbe 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -8533,6 +8533,9 @@ paths:
The maximum file size allowed for the organization's
icon. Useful for UI allowing editing the organization's icon.
+
+ **Changes**: New in Zulip 5.0 (feature level 72). Previously,
+ this was called `max_icon_file_size`.
realm_logo_url:
type: string
description: |
@@ -8672,7 +8675,7 @@ paths:
Whether push notifications are enabled for this organization. Typically
`false` for self-hosted servers that have not configured the
[Mobile push notifications service](https://zulip.readthedocs.io/en/latest/production/mobile-push-notifications.html).
- realm_upload_quota:
+ realm_upload_quota_mib:
type: integer
nullable: true
description: |
@@ -8684,6 +8687,9 @@ paths:
in the API only for display purposes.
Null if there is no limit.
+
+ **Changes**: New in Zulip 5.0 (feature level 72). Previously,
+ this was called `realm_upload_quota`.
realm_plan_type:
type: integer
description: |
diff --git a/zerver/tests/test_home.py b/zerver/tests/test_home.py
index a5caed660cc..65c1c2fafff 100644
--- a/zerver/tests/test_home.py
+++ b/zerver/tests/test_home.py
@@ -194,7 +194,7 @@ class HomeTest(ZulipTestCase):
"realm_push_notifications_enabled",
"realm_send_welcome_emails",
"realm_signup_notifications_stream_id",
- "realm_upload_quota",
+ "realm_upload_quota_mib",
"realm_uri",
"realm_user_group_edit_policy",
"realm_user_groups",