mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-14 05:57:18 +00:00
Allow -r switch to reverse all filtering i.e. only show mutes
This commit is contained in:
parent
a7efa1d728
commit
5528010cc5
1 changed files with 7 additions and 1 deletions
|
@ -20,6 +20,7 @@ import { CaseTypes } from "../../../data/CaseTypes";
|
||||||
const opts = {
|
const opts = {
|
||||||
expand: ct.bool({ option: true, isSwitch: true, shortcut: "e" }),
|
expand: ct.bool({ option: true, isSwitch: true, shortcut: "e" }),
|
||||||
hidden: ct.bool({ option: true, isSwitch: true, shortcut: "h" }),
|
hidden: ct.bool({ option: true, isSwitch: true, shortcut: "h" }),
|
||||||
|
reverseFilters: ct.switchOption({ shortcut: "r" }),
|
||||||
onlyNotes: ct.switchOption({ shortcut: "n" }),
|
onlyNotes: ct.switchOption({ shortcut: "n" }),
|
||||||
onlyWarns: ct.switchOption({ shortcut: "w" }),
|
onlyWarns: ct.switchOption({ shortcut: "w" }),
|
||||||
onlyMutes: ct.switchOption({ shortcut: "m" }),
|
onlyMutes: ct.switchOption({ shortcut: "m" }),
|
||||||
|
@ -57,7 +58,12 @@ export const CasesUserCmd = modActionsCmd({
|
||||||
if (args.onyUnmutes) typesToShow.push(CaseTypes.Unmute);
|
if (args.onyUnmutes) typesToShow.push(CaseTypes.Unmute);
|
||||||
if (args.onlyBans) typesToShow.push(CaseTypes.Ban);
|
if (args.onlyBans) typesToShow.push(CaseTypes.Ban);
|
||||||
if (args.onyUnbans) typesToShow.push(CaseTypes.Unban);
|
if (args.onyUnbans) typesToShow.push(CaseTypes.Unban);
|
||||||
if (typesToShow.length > 0) cases = cases.filter(c => typesToShow.includes(c.type));
|
|
||||||
|
if (typesToShow.length > 0) {
|
||||||
|
if (args.reverseFilters) cases = cases.filter(c => !typesToShow.includes(c.type));
|
||||||
|
// Reversed: Hide specified types
|
||||||
|
else cases = cases.filter(c => typesToShow.includes(c.type)); // Normal: Show only specified types
|
||||||
|
}
|
||||||
|
|
||||||
const normalCases = cases.filter(c => !c.is_hidden);
|
const normalCases = cases.filter(c => !c.is_hidden);
|
||||||
const hiddenCases = cases.filter(c => c.is_hidden);
|
const hiddenCases = cases.filter(c => c.is_hidden);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue