fix(housekeeping): avoid ase preview self-redirect
This commit is contained in:
1 parent
f72a2b6c74
commit
a9bdd6bd5d
8 files changed
+31
-26
No files matched your search
@@ -14,5 +14,10 @@ export default async function AdminNextPage() {
|
||||
|
||||
if (!firstVisibleDomain) notFound();
|
||||
|
||||
redirect(toHousekeepingHref(firstVisibleDomain.canonicalHref, "preview"));
|
||||
const previewHref = toHousekeepingHref(
|
||||
firstVisibleDomain.canonicalHref,
|
||||
"preview",
|
||||
);
|
||||
|
||||
redirect(previewHref === "/ase-next" ? "/ase-next/operations" : previewHref);
|
||||
}
|
||||
@@ -407,13 +407,15 @@ describe("/ase-next first visible domain", () => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it("redirects an administrator to Operations in locked registry order", async () => {
|
||||
it("redirects an administrator away from the Operations preview root", async () => {
|
||||
routeMocks.getHousekeepingCapabilityContext.mockResolvedValue(
|
||||
capabilityContext([PERMS.ADMIN_DASHBOARD, PERMS.USERS_VIEW]),
|
||||
);
|
||||
|
||||
await expect(AdminNextPage()).rejects.toThrow("NEXT_REDIRECT:/ase-next");
|
||||
expect(routeMocks.redirect).toHaveBeenCalledWith("/ase-next");
|
||||
await expect(AdminNextPage()).rejects.toThrow(
|
||||
"NEXT_REDIRECT:/ase-next/operations",
|
||||
);
|
||||
expect(routeMocks.redirect).toHaveBeenCalledWith("/ase-next/operations");
|
||||
expect(routeMocks.getHousekeepingCapabilityContext).toHaveBeenCalledTimes(
|
||||
1,
|
||||
);
|
||||
|
||||
@@ -31,8 +31,7 @@ describe("contentMigrationEntries", () => {
|
||||
expect(
|
||||
contentMigrationEntries.every(
|
||||
(row) =>
|
||||
row.targetPath === null ||
|
||||
row.targetPath.startsWith("/admin/content/"),
|
||||
row.targetPath === null || row.targetPath.startsWith("/ase/content/"),
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
@@ -45,23 +44,23 @@ describe("contentMigrationEntries", () => {
|
||||
).toEqual([
|
||||
{
|
||||
legacyPath: "/admin/articles/:id",
|
||||
targetPath: "/admin/content/editorial/articles/:id",
|
||||
targetPath: "/ase/content/editorial/articles/:id",
|
||||
},
|
||||
{
|
||||
legacyPath: "/admin/ads/:id",
|
||||
targetPath: "/admin/content/media/ads/:id",
|
||||
targetPath: "/ase/content/media/ads/:id",
|
||||
},
|
||||
{
|
||||
legacyPath: "/admin/events/:id",
|
||||
targetPath: "/admin/content/engagement/events/:id",
|
||||
targetPath: "/ase/content/engagement/events/:id",
|
||||
},
|
||||
{
|
||||
legacyPath: "/admin/polls/:id",
|
||||
targetPath: "/admin/content/engagement/polls/:id",
|
||||
targetPath: "/ase/content/engagement/polls/:id",
|
||||
},
|
||||
{
|
||||
legacyPath: "/admin/help-questions/:id",
|
||||
targetPath: "/admin/content/help/questions/:id",
|
||||
targetPath: "/ase/content/help/questions/:id",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -27,8 +27,7 @@ describe("economyMigrationEntries", () => {
|
||||
expect(
|
||||
economyMigrationEntries.every(
|
||||
(row) =>
|
||||
row.targetPath === null ||
|
||||
row.targetPath.startsWith("/admin/economy/"),
|
||||
row.targetPath === null || row.targetPath.startsWith("/ase/economy/"),
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ describe("hotelMigrationEntries", () => {
|
||||
expect(
|
||||
hotelMigrationEntries.every(
|
||||
(row) =>
|
||||
row.targetPath === null || row.targetPath.startsWith("/admin/hotel/"),
|
||||
row.targetPath === null || row.targetPath.startsWith("/ase/hotel/"),
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
@@ -39,27 +39,27 @@ describe("hotelMigrationEntries", () => {
|
||||
).toEqual([
|
||||
{
|
||||
legacyPath: "/admin/rooms",
|
||||
targetPath: "/admin/hotel/rooms",
|
||||
targetPath: "/ase/hotel/rooms",
|
||||
decision: "REBUILD",
|
||||
},
|
||||
{
|
||||
legacyPath: "/admin/rooms/:id",
|
||||
targetPath: "/admin/hotel/rooms/:id",
|
||||
targetPath: "/ase/hotel/rooms/:id",
|
||||
decision: "MERGE",
|
||||
},
|
||||
{
|
||||
legacyPath: "/admin/rooms/:id/furni",
|
||||
targetPath: "/admin/hotel/rooms/:id/furni",
|
||||
targetPath: "/ase/hotel/rooms/:id/furni",
|
||||
decision: "REBUILD",
|
||||
},
|
||||
{
|
||||
legacyPath: "/admin/rooms/edit/:id",
|
||||
targetPath: "/admin/hotel/rooms/:id",
|
||||
targetPath: "/ase/hotel/rooms/:id",
|
||||
decision: "MERGE",
|
||||
},
|
||||
{
|
||||
legacyPath: "/admin/rooms/show/:id",
|
||||
targetPath: "/admin/hotel/rooms/:id",
|
||||
targetPath: "/ase/hotel/rooms/:id",
|
||||
decision: "MERGE",
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -10,7 +10,7 @@ describe("operationsMigrationEntries", () => {
|
||||
legacyPath: "/admin",
|
||||
sourceFile: "src/app/admin/page.tsx",
|
||||
targetDomain: "operations",
|
||||
targetPath: "/admin/work",
|
||||
targetPath: "/ase",
|
||||
decision: "REBUILD",
|
||||
capabilities: { read: [PERMS.ADMIN_DASHBOARD], mutate: [] },
|
||||
dependencies: {
|
||||
|
||||
@@ -29,7 +29,7 @@ describe("peopleMigrationEntries", () => {
|
||||
expect(modRows).toHaveLength(13);
|
||||
expect(modRows.every((row) => row.decision === "MERGE")).toBe(true);
|
||||
expect(
|
||||
modRows.every((row) => row.targetPath?.startsWith("/admin/people/")),
|
||||
modRows.every((row) => row.targetPath?.startsWith("/ase/people/")),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ describe("systemMigrationEntries", () => {
|
||||
expect(systemMigrationEntries).toContainEqual(
|
||||
expect.objectContaining({
|
||||
legacyPath: "/admin/permissions",
|
||||
targetPath: "/admin/system/access/permissions",
|
||||
targetPath: "/ase/system/access/permissions",
|
||||
decision: expect.not.stringMatching("REMOVE"),
|
||||
}),
|
||||
);
|
||||
@@ -75,10 +75,10 @@ describe("systemMigrationEntries", () => {
|
||||
|
||||
it("uses only the approved System target roots", () => {
|
||||
const allowedRoots = [
|
||||
"/admin/system/access",
|
||||
"/admin/system/configuration",
|
||||
"/admin/system/observability",
|
||||
"/admin/system/operations",
|
||||
"/ase/system/access",
|
||||
"/ase/system/configuration",
|
||||
"/ase/system/observability",
|
||||
"/ase/system/operations",
|
||||
];
|
||||
|
||||
expect(
|
||||
|
||||
Reference in new issue
Block a user