Fix .js on removed comments. Removed duplicate post_comment
This commit is contained in:
parent
b87df9db36
commit
09c84030b5
2 changed files with 11 additions and 48 deletions
|
@ -144,44 +144,6 @@ function delete_commentModal(id) {
|
|||
|
||||
};
|
||||
|
||||
|
||||
post_comment=function(fullname){
|
||||
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
form.append('formkey', formkey());
|
||||
form.append('parent_fullname', fullname);
|
||||
form.append('submission', document.getElementById('reply-form-submission-'+fullname).value);
|
||||
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"];
|
||||
var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
|
||||
myToast.hide();
|
||||
var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
|
||||
myToast.show();
|
||||
}
|
||||
else {
|
||||
var commentError = document.getElementById("comment-error-text");
|
||||
var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
|
||||
myToast.hide();
|
||||
var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
|
||||
myToast.show();
|
||||
commentError.textContent = JSON.parse(xhr.response)["error"];
|
||||
}
|
||||
}
|
||||
xhr.send(form)
|
||||
|
||||
document.getElementById('save-reply-to-'+fullname).classList.add('disabled');
|
||||
|
||||
}
|
||||
|
||||
post_reply=function(id){
|
||||
|
||||
var form = new FormData();
|
||||
|
@ -248,7 +210,7 @@ comment_edit=function(id){
|
|||
}
|
||||
xhr.send(form)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
post_comment=function(fullname, postId){
|
||||
|
||||
|
@ -259,6 +221,7 @@ post_comment=function(fullname, postId){
|
|||
form.append('submission', document.getElementById('reply-form-submission-'+fullname).value);
|
||||
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;
|
||||
|
|
|
@ -64,9 +64,9 @@
|
|||
<div id="comment-{{c.id}}-only">
|
||||
|
||||
<div class="user-info">
|
||||
<span class="comment-collapse d-md-none" onclick="collapse_comment('{{c.id}}')"></span>
|
||||
{% if standalone and c.over_18 %}<span class="badge badge-danger">+18</span> {% endif %}
|
||||
[{% if c.is_banned %}Removed by admins{% elif c.deleted_utc > 0 %}Deleted by author{% elif c.is_blocking %}You are blocking @{{c.author.username}}{% elif c.is_blocked %}This user has blocked you{% endif %}]
|
||||
<span class="comment-collapse d-md-none" onclick="collapse_comment('{{c.id}}')"></span>
|
||||
{% if standalone and c.over_18 %}<span class="badge badge-danger">+18</span> {% endif %}
|
||||
[{% if c.is_banned %}Removed by admins{% elif c.deleted_utc > 0 %}Deleted by author{% elif c.is_blocking %}You are blocking @{{c.author.username}}{% elif c.is_blocked %}This user has blocked you{% endif %}]
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -518,15 +518,15 @@
|
|||
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
(() => {
|
||||
const date = new Date('{{c.created_datetime}}');
|
||||
document.getElementById('timestamp-{{c.id}}').title = date.toString();
|
||||
})()
|
||||
(() => {
|
||||
const date = new Date('{{c.created_datetime}}');
|
||||
document.getElementById('timestamp-{{c.id}}').title = date.toString();
|
||||
})()
|
||||
</script>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endmacro %}
|
||||
|
||||
{% for comment in comments %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue