Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/__tests__/queue.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
);
});

Expand All @@ -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",
);
});
});
Expand Down Expand Up @@ -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);
});
Expand All @@ -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",
);
});

Expand Down
21 changes: 12 additions & 9 deletions src/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,14 @@ function appendBatchAwareLinks(appendLink) {
);
}

// Path-scoped dashboard base for the current repo. The dashboard routes on
// /orgs/<org>/repos/<repo>/…; 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.
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
Loading