ui: unify comment/update issue toasts

This commit is contained in:
Dotta
2026-03-07 10:32:22 -06:00
parent 1dac0ec7cf
commit dd14643848

View File

@@ -184,8 +184,8 @@ function buildActivityToast(
} }
if (action === "issue.updated") { if (action === "issue.updated") {
if (details?.reopened === true && readString(details.source) === "comment") { if (readString(details?.source) === "comment") {
// Reopen-via-comment emits a paired comment event; show one combined toast on the comment event. // Comment-driven updates emit a paired comment event; show one combined toast on the comment event.
return null; return null;
} }
const changeDesc = describeIssueUpdate(details); const changeDesc = describeIssueUpdate(details);
@@ -208,13 +208,18 @@ function buildActivityToast(
const commentId = readString(details?.commentId); const commentId = readString(details?.commentId);
const bodySnippet = readString(details?.bodySnippet); const bodySnippet = readString(details?.bodySnippet);
const reopened = details?.reopened === true; const reopened = details?.reopened === true;
const updated = details?.updated === true;
const reopenedFrom = readString(details?.reopenedFrom); const reopenedFrom = readString(details?.reopenedFrom);
const reopenedLabel = reopened const reopenedLabel = reopened
? reopenedFrom ? reopenedFrom
? `reopened from ${reopenedFrom.replace(/_/g, " ")}` ? `reopened from ${reopenedFrom.replace(/_/g, " ")}`
: "reopened" : "reopened"
: null; : null;
const title = reopened ? `${actor} reopened and commented on ${issue.ref}` : `${actor} commented on ${issue.ref}`; const title = reopened
? `${actor} reopened and commented on ${issue.ref}`
: updated
? `${actor} commented and updated ${issue.ref}`
: `${actor} commented on ${issue.ref}`;
const body = bodySnippet const body = bodySnippet
? reopenedLabel ? reopenedLabel
? `${reopenedLabel} - ${bodySnippet.replace(/^#+\s*/m, "").replace(/\n/g, " ")}` ? `${reopenedLabel} - ${bodySnippet.replace(/^#+\s*/m, "").replace(/\n/g, " ")}`