From dd8e3255a0d33a1c7261073e64655dfba32c024b Mon Sep 17 00:00:00 2001 From: Aevann Date: Mon, 23 Jan 2023 13:04:07 +0200 Subject: [PATCH] allow pasting images in DM replies --- files/assets/js/comments_v.js | 6 +++--- files/templates/comments.html | 14 ++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/files/assets/js/comments_v.js b/files/assets/js/comments_v.js index a4780877d..e869f09fc 100644 --- a/files/assets/js/comments_v.js +++ b/files/assets/js/comments_v.js @@ -119,7 +119,7 @@ function post_reply(id){ form.append('parent_id', id); form.append('body', document.getElementById('reply-form-body-'+id).value); try { - for (const e of document.getElementById(`file-upload-${id}`).files) + for (const e of document.getElementById(`file-upload-reply-c_${id}`).files) form.append('file', e); } catch(e) {} @@ -144,10 +144,10 @@ function post_reply(id){ document.getElementById('reply-form-body-'+id).value = '' document.getElementById('message-reply-'+id).innerHTML = '' toggleReplyBox('reply-message-c_'+id) - const fileupload = document.getElementById(`file-upload-${id}`) + const fileupload = document.getElementById(`file-upload-reply-c_${id}`) if (fileupload) { fileupload.value = null; - document.getElementById(`filename-${id}`).innerHTML = ''; + document.getElementById(`filename-show-reply-c_${id}`).innerHTML = ''; } } else { showToast(false, getMessageFromJsonData(false, data)); diff --git a/files/templates/comments.html b/files/templates/comments.html index cd14c8551..13159bef0 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -482,7 +482,10 @@ {% if v and v.id != c.author_id and c.body %}
{{c.body.strip()}}
{% endif %} - {{macros.comment_reply_box(c.fullname, "reply-to-" + c.fullname, "d-none", "collapsed child", 'reply-to-' + c.fullname, true)}} + + {% if c.parent_submission or c.wall_user_id %} + {{macros.comment_reply_box(c.fullname, "reply-to-" + c.fullname, "d-none", "collapsed child", 'reply-to-' + c.fullname, true)}} + {% endif %} {% if request.path.startswith('/transfers') %} @@ -513,20 +516,19 @@ - {# TODO: swap to comment_reply_box macro #}