Skip to content

Commit a17e643

Browse files
JulianMaurinclaude
andcommitted
fix: point the extension's dashboard links at the current path-scoped URLs
The dashboard moved to /orgs/<org>/repos/<repo>/… routing; the retired ?login=&repository= query form no longer resolves, so the extension's activity-log and merge-queue links (batch and non-batch) were landing on a dead route. Build them through a shared getDashboardRepoBase() helper; the query filters (pull_request, batch_pull, batch_pr, branch, pull-request-number) are unchanged. Test plan: - npx jest (72 passing) — every dashboard link asserts the path-scoped URL. - npx biome check — clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KJbLFjMX9mb8o5T3JXTAXL Change-Id: I3ea0d77ec82d5171847f15cba0e3d70356879454
1 parent f213e46 commit a17e643

2 files changed

Lines changed: 18 additions & 15 deletions

File tree

src/__tests__/queue.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ describe("batch-PR queue link", () => {
769769
test("deep-links to the batch peek drawer via batch_pr, using the base ref as branch", () => {
770770
setPrDom({ draft: true, author: "mergify", baseRef: "develop" });
771771
expect(getMergeQueueLink()).toBe(
772-
"https://dashboard.mergify.com/queues/status?login=acme&repository=widget&branch=develop&batch_pr=42",
772+
"https://dashboard.mergify.com/orgs/acme/repos/widget/queues/status?branch=develop&batch_pr=42",
773773
);
774774
});
775775

@@ -786,14 +786,14 @@ describe("batch-PR queue link", () => {
786786
test("omits branch (dashboard falls back) when the base ref can't be read", () => {
787787
setPrDom({ draft: true, author: "mergify" });
788788
expect(getMergeQueueLink()).toBe(
789-
"https://dashboard.mergify.com/queues/status?login=acme&repository=widget&batch_pr=42",
789+
"https://dashboard.mergify.com/orgs/acme/repos/widget/queues/status?batch_pr=42",
790790
);
791791
});
792792

793793
test("non-batch PR keeps the branch-scoped queue link", () => {
794794
setPrDom({ baseRef: "develop" });
795795
expect(getMergeQueueLink()).toBe(
796-
"https://dashboard.mergify.com/queues?login=acme&repository=widget&branch=main&pull-request-number=42",
796+
"https://dashboard.mergify.com/orgs/acme/repos/widget/queues?branch=main&pull-request-number=42",
797797
);
798798
});
799799
});
@@ -908,14 +908,14 @@ describe("batch-PR informational links", () => {
908908
}
909909

910910
const BATCH_ACTIVITY_LOG_HREF =
911-
"https://dashboard.mergify.com/activity-log?login=acme&repository=widget&batch_pull=42&preset=Past1month";
911+
"https://dashboard.mergify.com/orgs/acme/repos/widget/activity-log?batch_pull=42&preset=Past1month";
912912

913913
test("open batch PR: queue link deep-links via batch_pr, logs link via batch_pull", () => {
914914
setPrDom({ draft: true, author: "mergify", baseRef: "develop" });
915915
const row = buildMergifyRow();
916916
expect(linkLabels(row)).toEqual(["queue", "logs"]);
917917
expect(hrefOf(row, "queue")).toBe(
918-
"https://dashboard.mergify.com/queues/status?login=acme&repository=widget&branch=develop&batch_pr=42",
918+
"https://dashboard.mergify.com/orgs/acme/repos/widget/queues/status?branch=develop&batch_pr=42",
919919
);
920920
expect(hrefOf(row, "logs")).toBe(BATCH_ACTIVITY_LOG_HREF);
921921
});
@@ -933,7 +933,7 @@ describe("batch-PR informational links", () => {
933933
expect(linkLabels(row)).toEqual(["queue", "logs"]);
934934
expect(hrefOf(row, "queue")).toContain("pull-request-number=42");
935935
expect(hrefOf(row, "logs")).toBe(
936-
"https://dashboard.mergify.com/activity-log?login=acme&repository=widget&pull_request=42&preset=Past1month",
936+
"https://dashboard.mergify.com/orgs/acme/repos/widget/activity-log?pull_request=42&preset=Past1month",
937937
);
938938
});
939939

src/queue.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,14 @@ function appendBatchAwareLinks(appendLink) {
550550
);
551551
}
552552

553+
// Path-scoped dashboard base for the current repo. The dashboard routes on
554+
// /orgs/<org>/repos/<repo>/…; the retired ?login=&repository= query form no
555+
// longer resolves.
556+
function getDashboardRepoBase() {
557+
const data = getPullRequestData();
558+
return `https://dashboard.mergify.com/orgs/${encodeURIComponent(data.org)}/repos/${encodeURIComponent(data.repo)}`;
559+
}
560+
553561
// Activity log scoped to the current repo and filtered by one PR-number
554562
// param. Targets /activity-log directly — the retired /event-logs URL only
555563
// survives as a redirect + param-translation shim for old bookmarks.
@@ -559,12 +567,10 @@ function appendBatchAwareLinks(appendLink) {
559567
function getActivityLogLink(pullFilterName) {
560568
const data = getPullRequestData();
561569
const params = new URLSearchParams({
562-
login: data.org,
563-
repository: data.repo,
564570
[pullFilterName]: data.pull,
565571
preset: "Past1month",
566572
});
567-
return `https://dashboard.mergify.com/activity-log?${params}`;
573+
return `${getDashboardRepoBase()}/activity-log?${params}`;
568574
}
569575

570576
// Activity log filtered to the current PR's own events.
@@ -602,17 +608,14 @@ export function getMergeQueueLink() {
602608
// the drawer, and degrades to the branch-scoped queue view for a drained
603609
// batch or an older dashboard.
604610
if (isMergeQueueBatchPr()) {
605-
const params = new URLSearchParams({
606-
login: data.org,
607-
repository: data.repo,
608-
});
611+
const params = new URLSearchParams();
609612
const baseRef = getBaseRef();
610613
if (baseRef) params.set("branch", baseRef);
611614
params.set("batch_pr", data.pull);
612-
return `https://dashboard.mergify.com/queues/status?${params}`;
615+
return `${getDashboardRepoBase()}/queues/status?${params}`;
613616
}
614617

615-
return `https://dashboard.mergify.com/queues?login=${data.org}&repository=${data.repo}&branch=main&pull-request-number=${data.pull}`;
618+
return `${getDashboardRepoBase()}/queues?branch=main&pull-request-number=${data.pull}`;
616619
}
617620

618621
// Read the current payload from mqPayload via lazy require to sidestep the

0 commit comments

Comments
 (0)