Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement the atrocity that is filtering out inactivity notices that …
…cannot be actioned
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent 8435cbd commit 8cc3f58
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions functions/api/mod-queue/list.ts
Expand Up @@ -63,6 +63,26 @@ export async function onRequestGet(context: RequestContext) {

if (item) {
delete item.user?.email;

if (entryType === "inactivity") {
// Only include inactivity notices that a user can actually act on
const departments = {
DM: [1 << 11],
ET: [1 << 4, 1 << 12],
FM: [1 << 7],
WM: [1 << 6],
};

if (
!Object.entries(departments).find(
(dept) =>
item.departments.includes(dept[0]) &&
dept[1].find((p) => currentUser.permissions & p),
)
)
continue;
}

items.push({ ...item, id });
}
}
Expand Down

0 comments on commit 8cc3f58

Please sign in to comment.