diff --git a/src/__tests__/queue.test.js b/src/__tests__/queue.test.js index 3bc339b..941a085 100644 --- a/src/__tests__/queue.test.js +++ b/src/__tests__/queue.test.js @@ -769,7 +769,7 @@ describe("batch-PR queue link", () => { test("deep-links to the batch peek drawer via batch_pr, using the base ref as branch", () => { setPrDom({ draft: true, author: "mergify", baseRef: "develop" }); expect(getMergeQueueLink()).toBe( - "https://dashboard.mergify.com/queues/status?login=acme&repository=widget&branch=develop&batch_pr=42", + "https://dashboard.mergify.com/orgs/acme/repos/widget/queues/status?branch=develop&batch_pr=42", ); }); @@ -786,14 +786,14 @@ describe("batch-PR queue link", () => { test("omits branch (dashboard falls back) when the base ref can't be read", () => { setPrDom({ draft: true, author: "mergify" }); expect(getMergeQueueLink()).toBe( - "https://dashboard.mergify.com/queues/status?login=acme&repository=widget&batch_pr=42", + "https://dashboard.mergify.com/orgs/acme/repos/widget/queues/status?batch_pr=42", ); }); test("non-batch PR keeps the branch-scoped queue link", () => { setPrDom({ baseRef: "develop" }); expect(getMergeQueueLink()).toBe( - "https://dashboard.mergify.com/queues?login=acme&repository=widget&branch=main&pull-request-number=42", + "https://dashboard.mergify.com/orgs/acme/repos/widget/queues?branch=main&pull-request-number=42", ); }); }); @@ -908,14 +908,14 @@ describe("batch-PR informational links", () => { } const BATCH_ACTIVITY_LOG_HREF = - "https://dashboard.mergify.com/activity-log?login=acme&repository=widget&batch_pull=42&preset=Past1month"; + "https://dashboard.mergify.com/orgs/acme/repos/widget/activity-log?batch_pull=42&preset=Past1month"; test("open batch PR: queue link deep-links via batch_pr, logs link via batch_pull", () => { setPrDom({ draft: true, author: "mergify", baseRef: "develop" }); const row = buildMergifyRow(); expect(linkLabels(row)).toEqual(["queue", "logs"]); expect(hrefOf(row, "queue")).toBe( - "https://dashboard.mergify.com/queues/status?login=acme&repository=widget&branch=develop&batch_pr=42", + "https://dashboard.mergify.com/orgs/acme/repos/widget/queues/status?branch=develop&batch_pr=42", ); expect(hrefOf(row, "logs")).toBe(BATCH_ACTIVITY_LOG_HREF); }); @@ -933,7 +933,7 @@ describe("batch-PR informational links", () => { expect(linkLabels(row)).toEqual(["queue", "logs"]); expect(hrefOf(row, "queue")).toContain("pull-request-number=42"); expect(hrefOf(row, "logs")).toBe( - "https://dashboard.mergify.com/activity-log?login=acme&repository=widget&pull_request=42&preset=Past1month", + "https://dashboard.mergify.com/orgs/acme/repos/widget/activity-log?pull_request=42&preset=Past1month", ); }); diff --git a/src/queue.js b/src/queue.js index 217267e..efec891 100644 --- a/src/queue.js +++ b/src/queue.js @@ -550,6 +550,14 @@ function appendBatchAwareLinks(appendLink) { ); } +// Path-scoped dashboard base for the current repo. The dashboard routes on +// /orgs//repos//…; the retired ?login=&repository= query form no +// longer resolves. +function getDashboardRepoBase() { + const data = getPullRequestData(); + return `https://dashboard.mergify.com/orgs/${encodeURIComponent(data.org)}/repos/${encodeURIComponent(data.repo)}`; +} + // Activity log scoped to the current repo and filtered by one PR-number // param. Targets /activity-log directly — the retired /event-logs URL only // survives as a redirect + param-translation shim for old bookmarks. @@ -559,12 +567,10 @@ function appendBatchAwareLinks(appendLink) { function getActivityLogLink(pullFilterName) { const data = getPullRequestData(); const params = new URLSearchParams({ - login: data.org, - repository: data.repo, [pullFilterName]: data.pull, preset: "Past1month", }); - return `https://dashboard.mergify.com/activity-log?${params}`; + return `${getDashboardRepoBase()}/activity-log?${params}`; } // Activity log filtered to the current PR's own events. @@ -602,17 +608,14 @@ export function getMergeQueueLink() { // the drawer, and degrades to the branch-scoped queue view for a drained // batch or an older dashboard. if (isMergeQueueBatchPr()) { - const params = new URLSearchParams({ - login: data.org, - repository: data.repo, - }); + const params = new URLSearchParams(); const baseRef = getBaseRef(); if (baseRef) params.set("branch", baseRef); params.set("batch_pr", data.pull); - return `https://dashboard.mergify.com/queues/status?${params}`; + return `${getDashboardRepoBase()}/queues/status?${params}`; } - return `https://dashboard.mergify.com/queues?login=${data.org}&repository=${data.repo}&branch=main&pull-request-number=${data.pull}`; + return `${getDashboardRepoBase()}/queues?branch=main&pull-request-number=${data.pull}`; } // Read the current payload from mqPayload via lazy require to sidestep the