mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 19:31:58 +00:00
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:
@@ -922,7 +922,7 @@ run_test('initialize', () => {
|
|||||||
global.document = 'document-stub';
|
global.document = 'document-stub';
|
||||||
global.csrf_token = 'fake-csrf-token';
|
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 setup_upload_called = false;
|
||||||
let uppy_cancel_all_called = false;
|
let uppy_cancel_all_called = false;
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ run_test('upload_files', () => {
|
|||||||
upload.upload_files(uppy, config, []);
|
upload.upload_files(uppy, config, []);
|
||||||
assert.equal($("#compose-send-button").attr("disabled"), false);
|
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;
|
let show_error_message_called = false;
|
||||||
upload.show_error_message = (config, message) => {
|
upload.show_error_message = (config, message) => {
|
||||||
show_error_message_called = true;
|
show_error_message_called = true;
|
||||||
@@ -186,7 +186,7 @@ run_test('upload_files', () => {
|
|||||||
upload.upload_files(uppy, config, files);
|
upload.upload_files(uppy, config, files);
|
||||||
assert(show_error_message_called);
|
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;
|
let on_click_close_button_callback;
|
||||||
$(".compose-send-status-close").one = (event, callback) => {
|
$(".compose-send-status-close").one = (event, callback) => {
|
||||||
assert.equal(event, "click");
|
assert.equal(event, "click");
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ exports.build_user_avatar_widget = function (upload_function) {
|
|||||||
$("#user_avatar_file_input_error").expectOne(),
|
$("#user_avatar_file_input_error").expectOne(),
|
||||||
$("#user-settings-avatar").expectOne(),
|
$("#user-settings-avatar").expectOne(),
|
||||||
upload_function,
|
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 editability = get_editability(message, seconds_left_buffer);
|
||||||
const is_editable = editability === exports.editability_types.TOPIC_ONLY ||
|
const is_editable = editability === exports.editability_types.TOPIC_ONLY ||
|
||||||
editability === exports.editability_types.FULL;
|
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;
|
let file_upload_enabled = false;
|
||||||
|
|
||||||
if (max_file_upload_size > 0) {
|
if (max_file_upload_size > 0) {
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ exports.upload_files = function (uppy, config, files) {
|
|||||||
if (files.length === 0) {
|
if (files.length === 0) {
|
||||||
return;
|
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.'));
|
exports.show_error_message(config, i18n.t('File and image uploads have been disabled for this organization.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ exports.setup_upload = function (config) {
|
|||||||
debug: false,
|
debug: false,
|
||||||
autoProceed: true,
|
autoProceed: true,
|
||||||
restrictions: {
|
restrictions: {
|
||||||
maxFileSize: page_params.max_file_upload_size * 1024 * 1024,
|
maxFileSize: page_params.max_file_upload_size_mib * 1024 * 1024,
|
||||||
},
|
},
|
||||||
locale: {
|
locale: {
|
||||||
strings: {
|
strings: {
|
||||||
|
|||||||
@@ -97,7 +97,7 @@
|
|||||||
<input type="file" id="file_input" class="notvisible pull-left" multiple />
|
<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-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>
|
<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>
|
<a class="message-control-button fa fa-paperclip notdisplayed" aria-hidden="true" id="attach_files" href="#" title="{{ _('Attach files') }}"></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a class="message-control-button fa fa-video-camera video_link" aria-hidden="true" href="#" title="{{ _('Add video call') }}"></a>
|
<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>
|
<i class="icon fa fa-book" aria-hidden="true"></i>
|
||||||
<div class="text">{{ _('Alert words') }}</div>
|
<div class="text">{{ _('Alert words') }}</div>
|
||||||
</li>
|
</li>
|
||||||
{% if max_file_upload_size > 0 %}
|
{% if max_file_upload_size_mib > 0 %}
|
||||||
<li tabindex="0" data-section="uploaded-files">
|
<li tabindex="0" data-section="uploaded-files">
|
||||||
<i class="icon fa fa-paperclip" aria-hidden="true"></i>
|
<i class="icon fa fa-paperclip" aria-hidden="true"></i>
|
||||||
<div class="text">{{ _('Uploaded files') }}</div>
|
<div class="text">{{ _('Uploaded files') }}</div>
|
||||||
|
|||||||
@@ -100,8 +100,8 @@ class HomeTest(ZulipTestCase):
|
|||||||
"last_event_id",
|
"last_event_id",
|
||||||
"left_side_userlist",
|
"left_side_userlist",
|
||||||
"login_page",
|
"login_page",
|
||||||
"max_avatar_file_size",
|
"max_avatar_file_size_mib",
|
||||||
"max_file_upload_size",
|
"max_file_upload_size_mib",
|
||||||
"max_icon_file_size",
|
"max_icon_file_size",
|
||||||
"max_logo_file_size",
|
"max_logo_file_size",
|
||||||
"max_message_id",
|
"max_message_id",
|
||||||
|
|||||||
@@ -253,8 +253,8 @@ def home_real(request: HttpRequest) -> HttpResponse:
|
|||||||
insecure_desktop_app = insecure_desktop_app,
|
insecure_desktop_app = insecure_desktop_app,
|
||||||
login_page = settings.HOME_NOT_LOGGED_IN,
|
login_page = settings.HOME_NOT_LOGGED_IN,
|
||||||
root_domain_uri = settings.ROOT_DOMAIN_URI,
|
root_domain_uri = settings.ROOT_DOMAIN_URI,
|
||||||
max_file_upload_size = settings.MAX_FILE_UPLOAD_SIZE,
|
max_file_upload_size_mib = settings.MAX_FILE_UPLOAD_SIZE,
|
||||||
max_avatar_file_size = settings.MAX_AVATAR_FILE_SIZE,
|
max_avatar_file_size_mib = settings.MAX_AVATAR_FILE_SIZE,
|
||||||
server_generation = settings.SERVER_GENERATION,
|
server_generation = settings.SERVER_GENERATION,
|
||||||
save_stacktraces = settings.SAVE_FRONTEND_STACKTRACES,
|
save_stacktraces = settings.SAVE_FRONTEND_STACKTRACES,
|
||||||
warn_no_email = settings.WARN_NO_EMAIL,
|
warn_no_email = settings.WARN_NO_EMAIL,
|
||||||
@@ -358,7 +358,7 @@ def home_real(request: HttpRequest) -> HttpResponse:
|
|||||||
'show_webathena': show_webathena,
|
'show_webathena': show_webathena,
|
||||||
'embedded': narrow_stream is not None,
|
'embedded': narrow_stream is not None,
|
||||||
'invite_as': PreregistrationUser.INVITE_AS,
|
'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)
|
patch_cache_control(response, no_cache=True, no_store=True, must_revalidate=True)
|
||||||
return response
|
return response
|
||||||
|
|||||||
Reference in New Issue
Block a user