mirror of https://github.com/zulip/zulip.git
home/page_params: Add suffix `_mib` to clarify the size units.
The docs say "megabytes" or "MB", but client software needs to know the actual meaning, which is in mebibytes.
This commit is contained in:
parent
bd9b74436c
commit
0c2b25cab3
|
@ -922,7 +922,7 @@ run_test('initialize', () => {
|
|||
global.document = 'document-stub';
|
||||
global.csrf_token = 'fake-csrf-token';
|
||||
|
||||
page_params.max_file_upload_size = 512;
|
||||
page_params.max_file_upload_size_mib = 512;
|
||||
|
||||
let setup_upload_called = false;
|
||||
let uppy_cancel_all_called = false;
|
||||
|
|
|
@ -176,7 +176,7 @@ run_test('upload_files', () => {
|
|||
upload.upload_files(uppy, config, []);
|
||||
assert.equal($("#compose-send-button").attr("disabled"), false);
|
||||
|
||||
page_params.max_file_upload_size = 0;
|
||||
page_params.max_file_upload_size_mib = 0;
|
||||
let show_error_message_called = false;
|
||||
upload.show_error_message = (config, message) => {
|
||||
show_error_message_called = true;
|
||||
|
@ -186,7 +186,7 @@ run_test('upload_files', () => {
|
|||
upload.upload_files(uppy, config, files);
|
||||
assert(show_error_message_called);
|
||||
|
||||
page_params.max_file_upload_size = 25;
|
||||
page_params.max_file_upload_size_mib = 25;
|
||||
let on_click_close_button_callback;
|
||||
$(".compose-send-status-close").one = (event, callback) => {
|
||||
assert.equal(event, "click");
|
||||
|
|
|
@ -74,7 +74,7 @@ exports.build_user_avatar_widget = function (upload_function) {
|
|||
$("#user_avatar_file_input_error").expectOne(),
|
||||
$("#user-settings-avatar").expectOne(),
|
||||
upload_function,
|
||||
page_params.max_avatar_file_size
|
||||
page_params.max_avatar_file_size_mib
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -254,7 +254,7 @@ function edit_message(row, raw_content) {
|
|||
const editability = get_editability(message, seconds_left_buffer);
|
||||
const is_editable = editability === exports.editability_types.TOPIC_ONLY ||
|
||||
editability === exports.editability_types.FULL;
|
||||
const max_file_upload_size = page_params.max_file_upload_size;
|
||||
const max_file_upload_size = page_params.max_file_upload_size_mib;
|
||||
let file_upload_enabled = false;
|
||||
|
||||
if (max_file_upload_size > 0) {
|
||||
|
|
|
@ -97,7 +97,7 @@ exports.upload_files = function (uppy, config, files) {
|
|||
if (files.length === 0) {
|
||||
return;
|
||||
}
|
||||
if (page_params.max_file_upload_size === 0) {
|
||||
if (page_params.max_file_upload_size_mib === 0) {
|
||||
exports.show_error_message(config, i18n.t('File and image uploads have been disabled for this organization.'));
|
||||
return;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ exports.setup_upload = function (config) {
|
|||
debug: false,
|
||||
autoProceed: true,
|
||||
restrictions: {
|
||||
maxFileSize: page_params.max_file_upload_size * 1024 * 1024,
|
||||
maxFileSize: page_params.max_file_upload_size_mib * 1024 * 1024,
|
||||
},
|
||||
locale: {
|
||||
strings: {
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
<input type="file" id="file_input" class="notvisible pull-left" multiple />
|
||||
<a class="message-control-button fa fa-smile-o" aria-hidden="true" id="emoji_map" href="#" title="{{ _('Add emoji') }}"></a>
|
||||
<a class="message-control-button fa fa-font" aria-hidden="true" title="{{ _('Formatting') }}" data-overlay-trigger="message-formatting"></a>
|
||||
{% if max_file_upload_size > 0 %}
|
||||
{% if max_file_upload_size_mib > 0 %}
|
||||
<a class="message-control-button fa fa-paperclip notdisplayed" aria-hidden="true" id="attach_files" href="#" title="{{ _('Attach files') }}"></a>
|
||||
{% endif %}
|
||||
<a class="message-control-button fa fa-video-camera video_link" aria-hidden="true" href="#" title="{{ _('Add video call') }}"></a>
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<i class="icon fa fa-book" aria-hidden="true"></i>
|
||||
<div class="text">{{ _('Alert words') }}</div>
|
||||
</li>
|
||||
{% if max_file_upload_size > 0 %}
|
||||
{% if max_file_upload_size_mib > 0 %}
|
||||
<li tabindex="0" data-section="uploaded-files">
|
||||
<i class="icon fa fa-paperclip" aria-hidden="true"></i>
|
||||
<div class="text">{{ _('Uploaded files') }}</div>
|
||||
|
|
|
@ -100,8 +100,8 @@ class HomeTest(ZulipTestCase):
|
|||
"last_event_id",
|
||||
"left_side_userlist",
|
||||
"login_page",
|
||||
"max_avatar_file_size",
|
||||
"max_file_upload_size",
|
||||
"max_avatar_file_size_mib",
|
||||
"max_file_upload_size_mib",
|
||||
"max_icon_file_size",
|
||||
"max_logo_file_size",
|
||||
"max_message_id",
|
||||
|
|
|
@ -246,26 +246,26 @@ def home_real(request: HttpRequest) -> HttpResponse:
|
|||
# These end up in a global JavaScript Object named 'page_params'.
|
||||
page_params = dict(
|
||||
# Server settings.
|
||||
development_environment = settings.DEVELOPMENT,
|
||||
debug_mode = settings.DEBUG,
|
||||
test_suite = settings.TEST_SUITE,
|
||||
poll_timeout = settings.POLL_TIMEOUT,
|
||||
insecure_desktop_app = insecure_desktop_app,
|
||||
login_page = settings.HOME_NOT_LOGGED_IN,
|
||||
root_domain_uri = settings.ROOT_DOMAIN_URI,
|
||||
max_file_upload_size = settings.MAX_FILE_UPLOAD_SIZE,
|
||||
max_avatar_file_size = settings.MAX_AVATAR_FILE_SIZE,
|
||||
server_generation = settings.SERVER_GENERATION,
|
||||
save_stacktraces = settings.SAVE_FRONTEND_STACKTRACES,
|
||||
warn_no_email = settings.WARN_NO_EMAIL,
|
||||
server_inline_image_preview = settings.INLINE_IMAGE_PREVIEW,
|
||||
development_environment = settings.DEVELOPMENT,
|
||||
debug_mode = settings.DEBUG,
|
||||
test_suite = settings.TEST_SUITE,
|
||||
poll_timeout = settings.POLL_TIMEOUT,
|
||||
insecure_desktop_app = insecure_desktop_app,
|
||||
login_page = settings.HOME_NOT_LOGGED_IN,
|
||||
root_domain_uri = settings.ROOT_DOMAIN_URI,
|
||||
max_file_upload_size_mib = settings.MAX_FILE_UPLOAD_SIZE,
|
||||
max_avatar_file_size_mib = settings.MAX_AVATAR_FILE_SIZE,
|
||||
server_generation = settings.SERVER_GENERATION,
|
||||
save_stacktraces = settings.SAVE_FRONTEND_STACKTRACES,
|
||||
warn_no_email = settings.WARN_NO_EMAIL,
|
||||
server_inline_image_preview = settings.INLINE_IMAGE_PREVIEW,
|
||||
server_inline_url_embed_preview = settings.INLINE_URL_EMBED_PREVIEW,
|
||||
password_min_length = settings.PASSWORD_MIN_LENGTH,
|
||||
password_min_guesses = settings.PASSWORD_MIN_GUESSES,
|
||||
jitsi_server_url = settings.JITSI_SERVER_URL,
|
||||
search_pills_enabled = settings.SEARCH_PILLS_ENABLED,
|
||||
server_avatar_changes_disabled = settings.AVATAR_CHANGES_DISABLED,
|
||||
server_name_changes_disabled = settings.NAME_CHANGES_DISABLED,
|
||||
password_min_length = settings.PASSWORD_MIN_LENGTH,
|
||||
password_min_guesses = settings.PASSWORD_MIN_GUESSES,
|
||||
jitsi_server_url = settings.JITSI_SERVER_URL,
|
||||
search_pills_enabled = settings.SEARCH_PILLS_ENABLED,
|
||||
server_avatar_changes_disabled = settings.AVATAR_CHANGES_DISABLED,
|
||||
server_name_changes_disabled = settings.NAME_CHANGES_DISABLED,
|
||||
|
||||
# Misc. extra data.
|
||||
have_initial_messages = user_has_messages,
|
||||
|
@ -358,7 +358,7 @@ def home_real(request: HttpRequest) -> HttpResponse:
|
|||
'show_webathena': show_webathena,
|
||||
'embedded': narrow_stream is not None,
|
||||
'invite_as': PreregistrationUser.INVITE_AS,
|
||||
'max_file_upload_size': settings.MAX_FILE_UPLOAD_SIZE,
|
||||
'max_file_upload_size_mib': settings.MAX_FILE_UPLOAD_SIZE,
|
||||
},)
|
||||
patch_cache_control(response, no_cache=True, no_store=True, must_revalidate=True)
|
||||
return response
|
||||
|
|
Loading…
Reference in New Issue