Skip to content

Commit 15b273b

Browse files
JulianMaurinclaude
andcommitted
feat: point the per-PR logs link directly at the activity log
The logs link on non-batch PRs targeted the retired /event-logs URL, riding the dashboard's redirect + param-translation shim (pullRequestNumber → pull_request) and landing on the activity log's default 1-hour window — empty for any PR queued earlier. Target /activity-log directly with pull_request and preset=Past1month, through a URL builder shared with the batch link. getEventLogLink() becomes getPullRequestActivityLogLink(), named after its destination. The "logs" label is unchanged. MRGFY-7878 Test plan: - npx jest (279 passing) — non-batch PRs assert the direct activity-log URL with pull_request and preset; batch link unchanged. - npx biome check — clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QyefSTmdtUKXCSbYRJvSQu Change-Id: Idcbe837c50b3be3ab05a8e875116804ae977a822
1 parent b2c998c commit 15b273b

2 files changed

Lines changed: 23 additions & 15 deletions

File tree

src/__tests__/queue.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -927,13 +927,13 @@ describe("batch-PR informational links", () => {
927927
expect(hrefOf(row, "logs")).toBe(BATCH_ACTIVITY_LOG_HREF);
928928
});
929929

930-
test("open non-batch PR keeps both the queue and per-PR event-log links", () => {
930+
test("open non-batch PR keeps both the queue and per-PR activity-log links", () => {
931931
setPrDom({ author: "octocat", baseRef: "develop" });
932932
const row = buildMergifyRow();
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/event-logs?login=acme&repository=widget&pullRequestNumber=42",
936+
"https://dashboard.mergify.com/activity-log?login=acme&repository=widget&pull_request=42&preset=Past1month",
937937
);
938938
});
939939

src/queue.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -544,34 +544,42 @@ function appendBatchAwareLinks(appendLink) {
544544
appendLink(getMergeQueueLink(), "queue", QUEUE_ICON_SVG);
545545
}
546546
appendLink(
547-
batch ? getBatchActivityLogLink() : getEventLogLink(),
547+
batch ? getBatchActivityLogLink() : getPullRequestActivityLogLink(),
548548
"logs",
549549
LOGS_ICON_SVG,
550550
);
551551
}
552552

553-
export function getEventLogLink() {
554-
const data = getPullRequestData();
555-
return `https://dashboard.mergify.com/event-logs?login=${data.org}&repository=${data.repo}&pullRequestNumber=${data.pull}`;
556-
}
557-
558-
// Activity log pivoted to a batch's own lifecycle events via its batch_pull
559-
// filter — a batch PR has no per-PR event log, so this replaces
560-
// getEventLogLink() on batch PRs. preset=Past1month widens the page's default
561-
// 1-hour window, which would render empty for any batch older than an hour
562-
// (a drained batch's post-mortem being the main use); same convention as the
553+
// Activity log scoped to the current repo and filtered by one PR-number
554+
// param. Targets /activity-log directly — the retired /event-logs URL only
555+
// survives as a redirect + param-translation shim for old bookmarks.
556+
// preset=Past1month widens the page's default 1-hour window, which would
557+
// render empty for events older than an hour; same convention as the
563558
// dashboard's own queue → activity-log deep link.
564-
export function getBatchActivityLogLink() {
559+
function getActivityLogLink(pullFilterName) {
565560
const data = getPullRequestData();
566561
const params = new URLSearchParams({
567562
login: data.org,
568563
repository: data.repo,
569-
batch_pull: data.pull,
564+
[pullFilterName]: data.pull,
570565
preset: "Past1month",
571566
});
572567
return `https://dashboard.mergify.com/activity-log?${params}`;
573568
}
574569

570+
// Activity log filtered to the current PR's own events.
571+
export function getPullRequestActivityLogLink() {
572+
return getActivityLogLink("pull_request");
573+
}
574+
575+
// Activity log pivoted to a batch's lifecycle events via its batch_pull
576+
// filter — a batch PR has no per-PR event log, so this replaces
577+
// getPullRequestActivityLogLink() on batch PRs (a drained batch's post-mortem
578+
// being the main use).
579+
export function getBatchActivityLogLink() {
580+
return getActivityLogLink("batch_pull");
581+
}
582+
575583
// Base branch of the current PR, read from the classic PR UI. The
576584
// `.commit-ref.base-ref` span is titled "owner/repo:branch"; ref names can't
577585
// contain ":", so everything after the first colon is the branch (which may

0 commit comments

Comments
 (0)