diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/attachment.js | 15 | ||||
-rw-r--r-- | js/comment-tagging.js | 2 | ||||
-rw-r--r-- | js/field.js | 4 | ||||
-rw-r--r-- | js/global.js | 2 |
4 files changed, 22 insertions, 1 deletions
diff --git a/js/attachment.js b/js/attachment.js index f967f64d3..6d6dae58d 100644 --- a/js/attachment.js +++ b/js/attachment.js @@ -93,6 +93,21 @@ function DataFieldHandler() { } } } + + // Check the current file size (in KB) + const file_size = field_data.files[0].size / 1024; + const max_size = BUGZILLA.param.maxattachmentsize; + const invalid = file_size > max_size; + const message = invalid ? `This file (<strong>${(file_size / 1024).toFixed(1)} MB</strong>) is larger than the ` + + `maximum allowed size (<strong>${(max_size / 1024).toFixed(1)} MB</strong>).<br>Please consider uploading it ` + + `to an online file storage and sharing the link in a bug comment instead.` : ''; + const message_short = invalid ? 'File too large' : ''; + const $error = document.querySelector('#data-error'); + + // Show an error message if the file is too large + $error.innerHTML = message; + field_data.setCustomValidity(message_short); + field_data.setAttribute('aria-invalid', invalid); } function clearAttachmentFields() { diff --git a/js/comment-tagging.js b/js/comment-tagging.js index 3897d46b8..44ca8b4ab 100644 --- a/js/comment-tagging.js +++ b/js/comment-tagging.js @@ -35,6 +35,8 @@ YAHOO.bugzilla.commentTagging = { if (!can_edit) return; $('#bz_ctag_add').devbridgeAutocomplete({ + appendTo: $('#main-inner'), + forceFixPosition: true, serviceUrl: function(query) { return 'rest/bug/comment/tags/' + encodeURIComponent(query); }, diff --git a/js/field.js b/js/field.js index 85011342d..a5e204f8d 100644 --- a/js/field.js +++ b/js/field.js @@ -713,6 +713,8 @@ $(function() { } var options_user = { + appendTo: $('#main-inner'), + forceFixPosition: true, serviceUrl: 'rest/elastic/suggest_users', params: { Bugzilla_api_token: BUGZILLA.api_token, @@ -792,6 +794,8 @@ $(function() { .each(function() { var that = $(this); that.devbridgeAutocomplete({ + appendTo: $('#main-inner'), + forceFixPosition: true, lookup: function(query, done) { var values = BUGZILLA.autocomplete_values[that.data('values')]; query = query.toLowerCase(); diff --git a/js/global.js b/js/global.js index 68aceb03f..d0396d6a8 100644 --- a/js/global.js +++ b/js/global.js @@ -219,7 +219,7 @@ const detect_blocked_gravatars = () => { */ const adjust_scroll_onload = () => { if (location.hash) { - const $target = document.querySelector(location.hash); + const $target = document.querySelector(CSS.escape(location.hash)); if ($target) { window.setTimeout(() => scroll_element_into_view($target), 50); |