Implement the atrocity that is filtering out inactivity notices that cannot be actioned
This commit is contained in:
parent
8435cbdcb2
commit
8cc3f58ca2
@ -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 });
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user