same as last commit but for comments

remotes/1693176582716663532/tmp_refs/heads/watchparty
Aevann1 2022-11-03 17:43:00 +02:00
parent 32f079ed20
commit 24529678ce
1 changed files with 57 additions and 33 deletions

View File

@ -1,41 +1,65 @@
function removeComment(t,post_id,button1,button2,cls) {
url="/remove_comment/"+post_id
function removeComment(t,comment_id,button1,button2,cls) {
url="/remove_comment/"+comment_id
postToast(t,url,button1,button2,cls)
if (window.location.pathname == '/admin/reported/comments')
{
document.getElementById("post-info-"+post_id).remove()
document.getElementById("comment-"+post_id).remove()
}
else
{
try {
document.getElementById("comment-"+post_id+"-only").classList.add("banned");
} catch(e) {
document.getElementById("context").classList.add("banned");
t.disabled = true;
t.classList.add("disabled");
postToast_callback(url,
{
},
(xhr) => {
if (xhr.status >= 200 && xhr.status < 300) {
if (window.location.pathname == '/admin/reported/comments')
{
document.getElementById("post-info-"+comment_id).remove()
document.getElementById("comment-"+comment_id).remove()
}
else
{
try {
document.getElementById("comment-"+comment_id+"-only").classList.add("banned");
} catch(e) {
document.getElementById("context").classList.add("banned");
}
document.getElementById(button1).classList.toggle(cls);
document.getElementById(button2).classList.toggle(cls);
}
}
t.disabled = false;
t.classList.remove("disabled");
}
}
};
);
}
function approveComment(t,post_id,button1,button2,cls) {
url="/approve_comment/"+post_id
function approveComment(t,comment_id,button1,button2,cls) {
url="/approve_comment/"+comment_id
postToast(t,url,button1,button2,cls)
if (window.location.pathname == '/admin/reported/comments')
{
document.getElementById("post-info-"+post_id).remove()
document.getElementById("comment-"+post_id).remove()
}
else
{
try {
document.getElementById("comment-"+post_id+"-only").classList.remove("banned");
} catch(e) {
document.getElementById("context").classList.remove("banned");
t.disabled = true;
t.classList.add("disabled");
postToast_callback(url,
{
},
(xhr) => {
if (xhr.status >= 200 && xhr.status < 300) {
if (window.location.pathname == '/admin/reported/comments')
{
document.getElementById("post-info-"+comment_id).remove()
document.getElementById("comment-"+comment_id).remove()
}
else
{
try {
document.getElementById("comment-"+comment_id+"-only").classList.remove("banned");
} catch(e) {
document.getElementById("context").classList.remove("banned");
}
document.getElementById(button1).classList.toggle(cls);
document.getElementById(button2).classList.toggle(cls);
}
}
t.disabled = false;
t.classList.remove("disabled");
}
}
);
}
function adminToggleMute(userId, muteStatus, buttonId) {