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

This commit is contained in:
RhenCloud committed 2026-08-15 18:25:23 +08:00
1 parent 2f8a87048e
commit 7ac7bb7958
4 files changed
+13 -31

No files matched your search

-17
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,