fix(render): link title head to the event object URL

This commit is contained in:
RhenCloud 2026-08-15 18:25:23 +08:00
parent 2f8a87048e
commit 7ac7bb7958
No known key found for this signature in database
GPG key ID: A574A617378C4E0B
4 changed files with 13 additions and 31 deletions

View file

@ -31,23 +31,6 @@ export function splitMessageTitle(title: string): TitleParts {
return { head: title.slice(0, idx), subject: title.slice(idx + 2) };
}
/**
* Repository URL derived from an event URL (origin + owner + repo). Returns
* undefined when there is no URL to derive from callers then render the
* title without a link.
*/
export function repoUrlFromMessage(url: string | undefined): string | undefined {
if (!url) return undefined;
try {
const parsed = new URL(url);
const segments = parsed.pathname.split("/").filter(Boolean);
if (segments.length >= 2) return `${parsed.origin}/${segments[0]}/${segments[1]}`;
} catch {
// not a parseable URL — no link
}
return undefined;
}
export function buildMessage(
partial: Omit<Partial<NeutralMessage>, "title"> & { title: string },
t: T,