fix comment posting
parent
f1e01cc1ba
commit
fd5e57d00d
|
@ -191,7 +191,7 @@ function comment_edit(id){
|
|||
xhr[0].send(xhr[1]);
|
||||
}
|
||||
|
||||
function post_comment(fullname, wall_user_id, hide){
|
||||
function postComment(fullname, hide){
|
||||
const btn = document.getElementById('save-reply-to-'+fullname)
|
||||
btn.disabled = true
|
||||
btn.classList.add('disabled');
|
||||
|
@ -210,8 +210,7 @@ function post_comment(fullname, wall_user_id, hide){
|
|||
catch(e) {}
|
||||
|
||||
const xhr = new XMLHttpRequest();
|
||||
if (wall_user_id == 'None') url = "/comment"
|
||||
else url = '/wall_comment'
|
||||
url = '/comments/';
|
||||
xhr.open("post", url);
|
||||
xhr.setRequestHeader('xhr', 'xhr');
|
||||
xhr.onload=function(){
|
||||
|
|
|
@ -506,7 +506,7 @@
|
|||
{% if v and v.id != c.author_id and c.body %}
|
||||
<div autocomplete="off" class="markdown d-none card border my-2 p-3 comment-box form-control rounded" id="markdown-{{c.id}}" readonly>{{c.body.strip()}}</div>
|
||||
{% endif %}
|
||||
{{macros.comment_reply_box(c.fullname, "reply-to-" + c.fullname, "d-none", "collapsed child", true, '/comments/')}}
|
||||
{{macros.comment_reply_box(c.fullname, "reply-to-" + c.fullname, "d-none", "collapsed child", true, 'reply-to-' + c.fullname, '/comments/')}}
|
||||
|
||||
{% if request.path.startswith('/transfers') %}
|
||||
<a href="{{c.log_link}}"><i class="far fa-link ml-1 text-muted"></i></a>
|
||||
|
|
|
@ -329,7 +329,7 @@
|
|||
</div>
|
||||
|
||||
{% if not p.deleted_utc %}
|
||||
{{macros.comment_reply_box(p.fullname, 'comment-reply-' + p.fullname, '', 'mb-3', true)}}
|
||||
{{macros.comment_reply_box(p.fullname, 'comment-reply-' + p.fullname, '', 'mb-3', '', true, '/comments/')}}
|
||||
{% endif %}
|
||||
|
||||
{% if p.replies %}
|
||||
|
|
|
@ -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', true, '/comments/')}}
|
||||
{{macros.comment_reply_box(u.fullname, 'replying-to-' + u.fullname, '', 'mb-3', '', true, '/comments/')}}
|
||||
<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}}">
|
||||
|
|
|
@ -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="", 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/") %}
|
||||
<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}}">
|
||||
|
@ -135,7 +135,7 @@
|
|||
</label>
|
||||
{% 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="post_comment('{{target_fullname}}', 'None');remove_dialog()">Comment</button>
|
||||
<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>
|
||||
</form>
|
||||
<div id="form-preview-{{target_fullname}}" class="preview mb-3 mt-5"></div>
|
||||
<div class="form-text text-small p-0 m-0"><a href="/formatting" {% if v and v.newtab %}data-target="t"target="_blank"{% endif %}>Formatting help</a></div>
|
||||
|
|
Loading…
Reference in New Issue