remotes/1693045480750635534/spooky-22
Aevann1 2021-08-31 18:58:08 +02:00
parent 7841d6f2ed
commit 1a2ce00993
3 changed files with 8 additions and 6 deletions

View File

@ -165,12 +165,13 @@ def message2(v, username):
return redirect(f"/@{username}")
@app.post("/@<username>/reply/<id>")
@app.post("/reply/<id>")
@auth_required
def messagereply(v, username, id):
message = request.form.get("message", "")[:1000].strip()
user = get_user(username)
message = request.form.get("message")[:1000].strip()
user = request.form.get("sentto")
id = request.form.get("parent_id")
message = message.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n").replace("\n\n\n", "\n\n")
# check existing

View File

@ -169,9 +169,10 @@
<a class="btn btn-primary" href="javascript:void(0)" onclick="document.getElementById('reply-to-message-{{c.id}}').classList.toggle('d-none')">Reply</a>
<pre></pre>
<form class="d-none" id="reply-to-message-{{c.id}}" action="/@{{c.author.username}}/reply/{{c.id}}" method="post" class="input-group" enctype="multipart/form-data">
<form class="d-none" 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}}">
<input type="hidden" name="parent_fullname" value="{{c.fullname}}">
<input type="hidden" name="parent_id" value="{{c.id}}">
<input type="hidden" name="sentto" value="{{c.author.username}}">
<textarea name="body" form="reply-to-t3_{{c.id}}" class="comment-box form-control rounded" id="reply-form-body-{{c.fullname}}" aria-label="With textarea" rows="3"></textarea>
<div class="comment-format" id="comment-format-bar-{{c.id}}">
<label class="btn btn-secondary format d-inline-block m-0" for="gif-reply-btn-{{c.fullname}}">

View File

@ -528,7 +528,7 @@
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.open("post", "/reply");
xhr.withCredentials=true;
xhr.onload=function(){
if (xhr.status==200) {