Update JS to clean up reporting UI after addressing
This commit is contained in:
parent
a973677ff9
commit
60084e5eef
1 changed files with 17 additions and 4 deletions
|
@ -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')
|
||||
}
|
||||
|
||||
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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue