Fix DM and modmail replies 404ing (#65)

messages got borked completely by this commit

this reverts commit b649a16b46.

---

Snakes note: DM and modmail replies 404'd because dispatched
to the wrong endpoint. The fix to that affected cancel buttons
in some contexts, so this PR also fixes those. Cancel button
presence and behavior should be same as it was a ~week ago
(i.e. correct), and all reply everywhere seem to work right.

Co-authored-by: justcool393 <justcool393@gmail.com>
Reviewed-on: #65
Co-authored-by: justcool393 <justcool393@noreply.fsdfsd.net>
Co-committed-by: justcool393 <justcool393@noreply.fsdfsd.net>
pull/66/head
justcool393 2022-12-14 04:16:43 +00:00 committed by Snakes
parent 88352cc1cb
commit 34ce953884
5 changed files with 8 additions and 8 deletions

View File

@ -142,7 +142,7 @@ function post_reply(id){
document.getElementById('reply-form-body-'+id).value = ''
document.getElementById('message-reply-'+id).innerHTML = ''
toggleReplyBox('reply-to-c_'+id)
toggleReplyBox('reply-message-c_'+id)
const fileupload = document.getElementById('file-upload')
if (fileupload) {
fileupload.value = null;

View File

@ -539,10 +539,10 @@
<button type="button" class="btn btn-primary mr-3 {% if not c.author.is_muted %}d-none{% endif %}" id="unmute-user-{{c.id}}" onclick="postToastSwitch(this,'/unmute_user/{{c.author.id}}','mute-user-{{c.id}}','unmute-user-{{c.id}}','d-none')">Unmute</button>
{% endif %}
<button type="button" class="btn btn-primary nobackground" onclick="toggleReplyBox('reply-to-{{c.fullname}}')">Reply</button>
<button type="button" class="btn btn-primary nobackground" onclick="toggleReplyBox('reply-message-{{c.fullname}}')">Reply</button>
{# TODO: swap to comment_reply_box macro #}
<div id="reply-to-{{c.fullname}}" class="d-none">
<div id="reply-message-{{c.fullname}}" class="d-none">
<div id="comment-form-space-{{c.id}}" class="comment-write collapsed child">
<form id="reply-to-message-{{c.id}}" action="/reply" method="post" class="input-group" enctype="multipart/form-data">
<input type="hidden" name="formkey" value="{{v|formkey}}">
@ -558,7 +558,7 @@
{% endif %}
</div>
<button type="button" onclick="document.getElementById('reply-to-{{c.id}}').classList.add('d-none');remove_dialog()" class="btn btn-link text-muted ml-auto">Cancel</button>
<button type="button" onclick="document.getElementById('reply-message-{{c.fullname}}').classList.add('d-none');remove_dialog()" class="btn btn-link text-muted ml-auto">Cancel</button>
<button type="button" id="save-reply-to-{{c.id}}" class="btn btn-primary ml-2" onclick="post_reply('{{c.id}}');remove_dialog()">Reply</button>
</form>
<div id="message-reply-{{c.id}}" class="preview mt-2"></div>

View File

@ -328,7 +328,7 @@
</div>
{% if not p.deleted_utc %}
{{macros.comment_reply_box(p.fullname, 'comment-reply-' + p.fullname, '', 'mb-3', '', true, '/comments/')}}
{{macros.comment_reply_box(p.fullname, 'comment-reply-' + p.fullname, subwrapper_css_classes='mb-3', enable_cancel_button=false)}}
{% endif %}
{% if comment_info %}

View File

@ -1,7 +1,7 @@
{% extends "userpage/userpage.html" %}
{% block userpage_content %}
<div class="userpage-wall">
{{macros.comment_reply_box(u.fullname, 'replying-to-' + u.fullname, '', 'mb-3 mt-4', '', true, '/comments/')}}
{{macros.comment_reply_box(u.fullname, 'replying-to-' + u.fullname, '', 'mb-3 mt-4', '', enable_cancel_button=false)}}
<div class="row no-gutters {% if listing %}mt-md-3{% elif not listing %}my-md-3{% endif %} px-3 p-md-0 userpage-wall" style="margin-top: 10px;">
<div class="col">
<div class="comment-section" id="replies-of-{{u.fullname}}">

View File

@ -110,7 +110,7 @@
<span class="ml-2">{{p.views}} thread views</span>
{% endmacro %}
{% macro comment_reply_box(target_fullname, html_id, wrapper_css_classes="", subwrapper_css_classes="", hide="", allow_file_upload=true, action="/comments/") %}
{% macro comment_reply_box(target_fullname, html_id, wrapper_css_classes="", subwrapper_css_classes="", hide="", allow_file_upload=true, action="/comments/", enable_cancel_button=true) %}
<div class="comment-box-wrapper{% if wrapper_css_classes %} {{wrapper_css_classes}}{% endif %}" id="{{html_id}}">
{% if v %}
<div id="comment-form-space-{{target_fullname}}" class="comment-write {{subwrapper_css_classes}}">
@ -136,7 +136,7 @@
{% endif %}
</div>
<button type="button" id="save-reply-to-{{target_fullname}}" form="reply-to-{{target_fullname}}" class="btn btn-primary text-whitebtn ml-auto fl-r" onclick="postComment('{{target_fullname}}', '{{hide}}');remove_dialog();">Comment</button>
{% if target_fullname.startswith('c_') %}
{% if enable_cancel_button %}
<button type="button" onclick="document.getElementById('reply-to-{{target_fullname}}').classList.add('d-none');remove_dialog()" class="btn btn-link text-muted ml-auto fl-r mr-3">Cancel</button>
{% endif %}
</form>