fix(admin): live online widget, ticket queue clarity, i18n+contract coverage
Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
9177230dc2
commit
01126207dc
26 files changed
+1635
-114
No files matched your search
@@ -21,6 +21,7 @@ const ROUTES: Array<[string, string]> = [
|
||||
["shop", "PERMS.SHOP_VIEW"],
|
||||
["transactions", "PERMS.SHOP_VIEW"],
|
||||
["vouchers", "PERMS.SHOP_VIEW"],
|
||||
["marketplace", "PERMS.SHOP_VIEW"],
|
||||
["vpn", "PERMS.SETTINGS_VIEW"],
|
||||
["ip", "PERMS.SETTINGS_VIEW"],
|
||||
["maintenance", "PERMS.SETTINGS_VIEW"],
|
||||
@@ -32,11 +33,25 @@ const ROUTES: Array<[string, string]> = [
|
||||
["badges", "PERMS.CATALOG_VIEW"],
|
||||
["teams", "PERMS.USERS_VIEW"],
|
||||
["applications", "PERMS.USERS_VIEW"],
|
||||
["guilds", "PERMS.USERS_VIEW"],
|
||||
["tickets", "PERMS.TICKETS_VIEW"],
|
||||
["help-tickets", "PERMS.TICKETS_VIEW"],
|
||||
["permissions", "PERMS.PERMISSIONS_MANAGE"],
|
||||
["housekeeping", "PERMS.SETTINGS_VIEW"],
|
||||
["logs", "PERMS.LOGS_VIEW"],
|
||||
["catalog", "PERMS.CATALOG_VIEW"],
|
||||
["rooms/edit/[id]", "PERMS.ROOMS_EDIT"],
|
||||
];
|
||||
|
||||
const MOD_ROUTES: Array<[string, string]> = [
|
||||
["", "requireMod"],
|
||||
["cfh", "PERMS.MOD_CFH_VIEW"],
|
||||
["actions", "PERMS.MOD_ACTIONS"],
|
||||
["bans", "PERMS.MOD_BANS_VIEW"],
|
||||
["tickets", "PERMS.MOD_TICKETS_VIEW"],
|
||||
["team", "PERMS.MOD_TEAM_VIEW"],
|
||||
];
|
||||
|
||||
const ACTION_GATES: Array<[string, string]> = [
|
||||
["admin-settings.ts", "PERMS.SETTINGS_EDIT"],
|
||||
["admin-theme.ts", "PERMS.SETTINGS_EDIT"],
|
||||
@@ -54,6 +69,11 @@ const ACTION_GATES: Array<[string, string]> = [
|
||||
["admin-alerts.ts", "PERMS.NOTIFICATIONS_EDIT"],
|
||||
["commandocentrum.ts", "PERMS.RCON_EXECUTE"],
|
||||
["translations.ts", "PERMS.SETTINGS_EDIT"],
|
||||
["tickets.ts", "PERMS.TICKETS_EDIT"],
|
||||
["admin-help-tickets.ts", "PERMS.TICKETS_EDIT"],
|
||||
["permissions.ts", "PERMS.PERMISSIONS_MANAGE"],
|
||||
["admin-guilds.ts", "PERMS.USERS_EDIT"],
|
||||
["moderation.ts", "PERMS.MODERATION_EDIT"],
|
||||
];
|
||||
|
||||
describe("admin operations route contract", () => {
|
||||
@@ -63,6 +83,19 @@ describe("admin operations route contract", () => {
|
||||
expect(readFileSync(path, "utf8"), path).toContain(permission);
|
||||
});
|
||||
|
||||
it.each(MOD_ROUTES)("provides and guards /mod/%s", (route, permission) => {
|
||||
const path =
|
||||
route === "" ? "src/app/mod/page.tsx" : `src/app/mod/${route}/page.tsx`;
|
||||
expect(existsSync(path), path).toBe(true);
|
||||
const source = readFileSync(path, "utf8");
|
||||
const layout = readFileSync("src/app/mod/layout.tsx", "utf8");
|
||||
if (permission === "requireMod") {
|
||||
expect(layout).toContain("requireMod");
|
||||
} else {
|
||||
expect(source).toContain(permission);
|
||||
}
|
||||
});
|
||||
|
||||
it("guards radio section via layout", () => {
|
||||
const path = "src/app/admin/radio/layout.tsx";
|
||||
expect(existsSync(path), path).toBe(true);
|
||||
|
||||
Reference in new issue
Block a user