diff --git a/files/routes/users.py b/files/routes/users.py index b6b020d0b7..92d062fdc7 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -200,9 +200,11 @@ def messagereply(v, username, id): cache.delete_memoized(User.notification_messages, user) - if not request.referrer or request.referrer.endswith('/notifications'): return redirect(f"/notifications?all=true#comment-{id}") - else: return redirect(f"{request.referrer}#comment-{id}") - + return jsonify({"html": render_template("comments.html", + v=v, + comments=[c], + render_replies=False, + )}) @app.get("/2faqr/") @auth_required diff --git a/files/templates/comments.html b/files/templates/comments.html index 09a74e905b..6b0faaef68 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -168,192 +168,200 @@ {% if not c.parent_submission and c.author_id!=NOTIFICATIONS_ACCOUNT and c.author_id!=AUTOJANNY_ACCOUNT and c.author_id!=v.id %} Reply

-					
- -

-						
-						 
-						
-						 
-						
-						 
-						
-						 
-						
-						 
-						
+	
+					
+						 
+						 
+						 
+						
+ +   + +   + + Cancel + Reply +
+ Cancel + Reply
{% endif %} {% if c.parent_submission %} - {% if v and v.id==c.author_id %} - - {% endif %} - -
- +
{% endif %} -
{% endif %} {% endif %} -
diff --git a/files/templates/default.html b/files/templates/default.html index d81a5c8487..fa03bb02f1 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -519,6 +519,39 @@ } + post_reply=function(fullname){ + + var form = new FormData(); + + form.append('formkey', formkey()); + form.append('parent_fullname', fullname); + form.append('body', document.getElementById('reply-form-body-'+fullname).value); + form.append('file', document.getElementById('file-upload-reply-'+fullname).files[0]); + var xhr = new XMLHttpRequest(); + xhr.open("post", "/comment"); + xhr.withCredentials=true; + xhr.onload=function(){ + if (xhr.status==200) { + commentForm=document.getElementById('comment-form-space-'+fullname); + commentForm.innerHTML=JSON.parse(xhr.response)["html"]; + $('#toast-comment-success').toast('dispose'); + $('#toast-comment-error').toast('dispose'); + $('#toast-comment-success').toast('show'); + } + else { + var commentError = document.getElementById("comment-error-text"); + $('#toast-comment-success').toast('dispose'); + $('#toast-comment-error').toast('dispose'); + $('#toast-comment-error').toast('show'); + commentError.textContent = JSON.parse(xhr.response)["error"]; + } + } + xhr.send(form) + + document.getElementById('save-reply-to-'+fullname).classList.add('disabled'); + + } + herald_comment=function(cid){