diff --git a/files/routes/users.py b/files/routes/users.py index 38dfbfbdc..227c8f265 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -221,7 +221,10 @@ def message2(v, username): user = get_user(username, v=v) if hasattr(user, 'is_blocking') and user.is_blocking: return {"error": "You're blocking this user."}, 403 - if hasattr(user, 'is_blocked') and user.is_blocked: return {"error": "This user is blocking you."}, 403 + + if v.admin_level <= 1: + if hasattr(user, 'is_blocked') and user.is_blocked: return {"error": "This user is blocking you."}, 403 + message = request.values.get("message", "")[:1000].strip() # check existing diff --git a/files/templates/emoji_modal.html b/files/templates/emoji_modal.html index 229489e24..2c9bdd5b5 100644 --- a/files/templates/emoji_modal.html +++ b/files/templates/emoji_modal.html @@ -23,14 +23,14 @@ commentFormID = form; }; - const TEXTAREA_POS = 'curr-pos' + const TEXTAREA_POS_ATTR = 'data-curr-pos' // Insert EMOJI markdown into comment box function function getEmoji(searchTerm, form) { const commentBox = document.getElementById(form); const old = commentBox.value; - const curPos = commentBox.data(TEXTAREA_POS); + const curPos = parseInt(commentBox.getAttribute(TEXTAREA_POS_ATTR)); const firstHalf = old.slice(0, curPos) const lastHalf = old.slice(curPos) @@ -48,7 +48,7 @@ const newPos = curPos + emoji.length - commentBox.data(TEXTAREA_POS, newPos) + commentBox.setAttribute(TEXTAREA_POS_ATTR, newPos); } function loadEmojis(form) { @@ -92,7 +92,7 @@ container.innerHTML = container.innerHTML.replace(/@form@/g, form) const commentBox = document.getElementById(form); - commentBox.data(TEXTAREA_POS, commentBox.selectionStart) + commentBox.setAttribute(TEXTAREA_POS_ATTR, commentBox.selectionStart); for (i=0; i < emojis.length; i++) { diff --git a/files/templates/expanded_image_modal.html b/files/templates/expanded_image_modal.html index 02b26735a..078e1db1e 100644 --- a/files/templates/expanded_image_modal.html +++ b/files/templates/expanded_image_modal.html @@ -7,15 +7,16 @@ } event.preventDefault(); - var url= this.data('url'); + let source = (event.target || event.srcElement).parentNode; + var url= source.dataset.bsUrl; - expandDesktopImage(url,url); + expandDesktopImage(url); } } // Expand Images on Desktop - function expandDesktopImage(image, link) { + function expandDesktopImage(image) { // Link text diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index d7403cd81..ea885769d 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -190,7 +190,7 @@ {% endif %} {% if hcaptcha %} -
+
{% endif %} diff --git a/files/templates/submit.html b/files/templates/submit.html index 7d06489e6..2eec04eff 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -425,23 +425,23 @@ if (filename.endsWith(".jpg") || filename.endsWith(".jpeg") || filename.endsWith(".png") || filename.endsWith(".webp")) { f.files = files; - document.getElementById('filename-show').text(filename); - document.getElementById('urlblock').addClass('d-none'); + document.getElementById('filename-show').textContent = filename; + document.getElementById('urlblock').classList.add('d-none'); var fileReader = new FileReader(); fileReader.readAsDataURL(f.files[0]); - fileReader.addEventListener("load", function () {document.getElementById('image-preview').attr('src', this.result);}); - document.getElementById('file-upload').attr('required', false); + fileReader.addEventListener("load", function () {document.getElementById('image-preview').setAttribute('src', this.result);}); + document.getElementById('file-upload').setAttribute('required', 'false'); checkForRequired(); } } document.getElementById('file-upload').addEventListener('change', function(e){ f=document.getElementById('file-upload'); - document.getElementById('urlblock').addClass('d-none'); - document.getElementById('filename-show').text(document.getElementById('file-upload')[0].files[0].name); + document.getElementById('urlblock').classList.add('d-none'); + document.getElementById('filename-show').textContent = document.getElementById('file-upload').files[0].name; var fileReader = new FileReader(); fileReader.readAsDataURL(f.files[0]); - fileReader.addEventListener("load", function () {document.getElementById('image-preview').attr('src', this.result);}); + fileReader.addEventListener("load", function () {document.getElementById('image-preview').setAttribute('src', this.result);}); checkForRequired(); })