Add user post wiping

If a user has spammed a lot of posts and made a mess of the board, this
will allow us to delete all posts by the offending user from the same
IP.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-07-17 16:59:23 -07:00
parent 8ea95a927c
commit 1856adaf3b
6 changed files with 90 additions and 1 deletions

View File

@@ -7,6 +7,7 @@
if (typeof window.banWindowName === "undefined") {
window.banWindowName = "ban-window";
window.modifyWindowName = "modify-window";
window.wipeWindowName = "wipe-window";
}
if (typeof window.menuItemFactories !== "undefined") {
@@ -28,6 +29,15 @@ if (typeof window.menuItemFactories !== "undefined") {
openModifyWindow($(postElement).attr("data-modify-url"));
})
);
window.menuItemFactories.push(
(postElement) => $("<a>")
.text("Wipe user posts")
.attr("href", "#")
.on("click", (e) => {
e.preventDefault();
openWipeWindow($(postElement).attr("data-wipe-url"));
})
);
}
////////////////////////////////////////////////////////////////////////////////
@@ -88,4 +98,30 @@ function openModifyWindow(modifyUrl) {
modifyWindow.iframe.contentWindow.thisWindow = modifyWindow;
});
modifyWindow.show();
}
////////////////////////////////////////////////////////////////////////////////
// Wipe window
////////////////////////////////////////////////////////////////////////////////
function getWipeWindow() {
return window.top.jsFrame.getWindowByName(wipeWindowName);
}
function openWipeWindow(wipeUrl) {
if (window.top.jsFrame.containsWindowName(wipeWindowName)) {
getWipeWindow().closeFrame();
}
let wipeWindow = window.top.jsFrame.create({
title: "Wipe post",
name: wipeWindowName,
width: 475,
url: wipeUrl,
});
$(wipeWindow.iframe, "iframe").on("load", () => {
fitWindowToContent(wipeWindow);
wipeWindow.setResizable(false);
wipeWindow.iframe.contentWindow.thisWindow = wipeWindow;
});
wipeWindow.show();
}