Update JS to clean up reporting UI after addressing

This commit is contained in:
Julian Rota 2022-05-23 22:59:40 -04:00
parent a973677ff9
commit 60084e5eef

View file

@ -8,14 +8,27 @@ function filter_new_status(id, new_status) {
.then(json => {
if(json.result === 'Update successful') {
const postRow = document.getElementById(`post-${id}`);
if(document.location.pathname === '/admin/filtered_submissions') {
if(document.location.pathname === '/admin/filtered_submissions' || document.location.pathname === '/admin/reported/posts' ) {
postRow.parentElement.removeChild(postRow);
} else {
}
const approveLink = postRow.querySelector('a#filter-approve')
const removeLink = postRow.querySelector('a#filter-remove')
if(approveLink && removeLink) {
approveLink.parentElement.removeChild(approveLink);
removeLink.parentElement.removeChild(removeLink);
}
const reportButtonCell = document.getElementById(`flaggers-${id}`);
if(reportButtonCell) {
reportButtonCell.classList.add('d-none')
}
const reportButton = document.getElementById(`report-btn-${id}`);
if(reportButton) {
reportButton.parentElement.removeChild(reportButton);
}
document.getElementById('toast-post-success-text').innerText = json.result;
bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success')).show();
} else {