admin_settings: Change maxfilesize to max_file_upload_size.

Renamed maxfilesize to max_file_upload_size for consistency.
Related to #12152.
This commit is contained in:
vinitS101 2019-05-03 21:25:04 +05:30 committed by Tim Abbott
parent 3cb502974e
commit 81b5a72252
6 changed files with 15 additions and 13 deletions

View File

@ -830,7 +830,7 @@ function verify_filedrop_payload(payload) {
assert.equal(payload.url, '/json/user_uploads');
assert.equal(payload.fallback_id, 'file_input');
assert.equal(payload.paramname, 'file');
assert.equal(payload.maxfilesize, 512);
assert.equal(payload.max_file_upload_size, 512);
assert.equal(payload.data.csrfmiddlewaretoken, 'fake-csrf-token');
assert.deepEqual(payload.raw_droppable, ['text/uri-list', 'text/plain']);
assert.equal(typeof payload.drop, 'function');
@ -888,7 +888,7 @@ run_test('initialize', () => {
global.csrf_token = 'fake-csrf-token';
var filedrop_in_compose_checked = false;
page_params.maxfilesize = 512;
page_params.max_file_upload_size = 512;
$("#compose").filedrop = function (payload) {
verify_filedrop_payload(payload);
test_raw_file_drop(payload.rawDrop);

View File

@ -6,7 +6,9 @@ set_global('navigator', {
userAgent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)',
});
set_global('i18n', global.stub_i18n);
set_global('page_params', { });
set_global('page_params', {
max_file_upload_size: 25,
});
set_global('csrf_token', { });
global.patch_builtin('window', {
bridge: false,
@ -96,7 +98,7 @@ run_test('upload_error', () => {
var msg_prefix = 'translated: ';
var msg_1 = 'File upload is not yet available for your browser.';
var msg_2 = 'Unable to upload that many files at once.';
var msg_3 = '"foobar.txt" was too large; the maximum file size is 25MiB.';
var msg_3 = '"foobar.txt" was too large; the maximum file size is 25MB.';
var msg_4 = 'Sorry, the file was too large.';
var msg_5 = 'An unknown error occurred.';

View File

@ -104,7 +104,7 @@ exports.options = function (config) {
// sanitization not needed as the file name is not potentially parsed as HTML, etc.
var context = {
file_name: file.name,
file_size: page_params.maxfilesize,
file_size: page_params.max_file_upload_size,
};
msg = i18n.t('"__file_name__" was too large; the maximum file size is __file_size__MB.', context);
break;
@ -172,7 +172,7 @@ exports.options = function (config) {
url: "/json/user_uploads",
fallback_id: file_input, // Target for standard file dialog
paramname: "file",
maxfilesize: page_params.maxfilesize,
max_file_upload_size: page_params.max_file_upload_size,
data: {
// the token isn't automatically included in filedrop's post
csrfmiddlewaretoken: csrf_token,

View File

@ -58,10 +58,10 @@
paramname: 'userfile',
allowedfiletypes:[],
raw_droppable:[],
maxfiles: 25, // Ignored if queuefiles is set > 0
maxfilesize: 1, // MB file size limit
queuefiles: 0, // Max files before queueing (for large volume uploads)
queuewait: 200, // Queue wait time if full
maxfiles: 25, // Ignored if queuefiles is set > 0
max_file_upload_size: 1, // MB file size limit
queuefiles: 0, // Max files before queueing (for large volume uploads)
queuewait: 200, // Queue wait time if full
data: {},
headers: {},
drop: empty,
@ -474,7 +474,7 @@
return;
}
var reader = new FileReader(),
max_file_size = 1048576 * opts.maxfilesize;
max_file_size = 1048576 * opts.max_file_upload_size;
reader.index = fileIndex;
if (files[fileIndex].size > max_file_size) {

View File

@ -94,10 +94,10 @@ class HomeTest(ZulipTestCase):
"left_side_userlist",
"login_page",
"max_avatar_file_size",
"max_file_upload_size",
"max_icon_file_size",
"max_logo_file_size",
"max_message_id",
"maxfilesize",
"message_content_in_email_notifications",
"muted_topics",
"narrow",

View File

@ -191,7 +191,7 @@ def home_real(request: HttpRequest) -> HttpResponse:
poll_timeout = settings.POLL_TIMEOUT,
login_page = settings.HOME_NOT_LOGGED_IN,
root_domain_uri = settings.ROOT_DOMAIN_URI,
maxfilesize = settings.MAX_FILE_UPLOAD_SIZE,
max_file_upload_size = settings.MAX_FILE_UPLOAD_SIZE,
max_avatar_file_size = settings.MAX_AVATAR_FILE_SIZE,
server_generation = settings.SERVER_GENERATION,
use_websockets = settings.USE_WEBSOCKETS,