2022-11-03 15:43:00 +00:00
|
|
|
function removeComment(t,comment_id,button1,button2,cls) {
|
|
|
|
url="/remove_comment/"+comment_id
|
2022-07-16 21:00:02 +00:00
|
|
|
|
2022-11-03 19:07:08 +00:00
|
|
|
postToast(t, url,
|
|
|
|
button1,
|
|
|
|
button2,
|
|
|
|
cls,
|
|
|
|
() => {
|
|
|
|
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");
|
2022-11-03 15:43:00 +00:00
|
|
|
}
|
|
|
|
}
|
2022-10-23 15:51:46 +00:00
|
|
|
}
|
2022-11-03 15:43:00 +00:00
|
|
|
);
|
|
|
|
}
|
2022-07-16 21:00:02 +00:00
|
|
|
|
2022-11-03 15:43:00 +00:00
|
|
|
function approveComment(t,comment_id,button1,button2,cls) {
|
|
|
|
url="/approve_comment/"+comment_id
|
2022-07-16 21:00:02 +00:00
|
|
|
|
2022-11-03 19:07:08 +00:00
|
|
|
postToast(t, url,
|
|
|
|
button1,
|
|
|
|
button2,
|
|
|
|
cls,
|
|
|
|
() => {
|
|
|
|
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");
|
2022-11-03 15:43:00 +00:00
|
|
|
}
|
|
|
|
}
|
2022-10-23 15:51:46 +00:00
|
|
|
}
|
2022-11-03 15:43:00 +00:00
|
|
|
);
|
2022-09-01 21:29:27 +00:00
|
|
|
}
|
|
|
|
|
2022-10-24 20:38:54 +00:00
|
|
|
function adminToggleMute(userId, muteStatus, buttonId) {
|
2022-10-14 12:01:11 +00:00
|
|
|
const xhr = createXhrWithFormKey(`/mute_user/${userId}/${muteStatus}`);
|
|
|
|
xhr[0].onload = function() {
|
2022-09-01 21:29:27 +00:00
|
|
|
let data
|
2022-10-14 12:01:11 +00:00
|
|
|
try {data = JSON.parse(xhr[0].response)}
|
2022-09-01 21:29:27 +00:00
|
|
|
catch(e) {console.log(e)}
|
2022-10-14 12:01:11 +00:00
|
|
|
success = xhr[0].status >= 200 && xhr[0].status < 300;
|
2022-10-14 10:15:06 +00:00
|
|
|
showToast(success, getMessageFromJsonData(success, data));
|
2022-09-01 21:29:27 +00:00
|
|
|
};
|
2022-10-14 12:01:11 +00:00
|
|
|
xhr[0].send(xhr[1]);
|
2022-10-24 20:38:54 +00:00
|
|
|
document.getElementById('mute-user-' + buttonId).classList.toggle("d-none");
|
|
|
|
document.getElementById('unmute-user-' + buttonId).classList.toggle("d-none");
|
2022-09-01 21:29:27 +00:00
|
|
|
}
|