mirror of
https://github.com/ReCloudStudio/WebHooker.git
synced 2026-09-22 16:11:29 +00:00
fix(formatters): strip HTML from comment bodies so bot notifications render cleanly
This commit is contained in:
parent
fa227b1533
commit
3af50496a7
6 changed files with 74 additions and 9 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import type { NeutralMessage, NeutralAuthor } from "../types";
|
||||
import { GITHUB_COLORS } from "./colors";
|
||||
import { emojiPrefix, type T, buildMessage } from "./helpers";
|
||||
import { emojiPrefix, type T, buildMessage, htmlToText } from "./helpers";
|
||||
|
||||
export function formatIssueComment(
|
||||
payload: Record<string, unknown>,
|
||||
|
|
@ -22,7 +22,7 @@ export function formatIssueComment(
|
|||
|
||||
const al = t("actions." + action) ?? action;
|
||||
const em = (e: string): string => emojiPrefix(e, showEmoji);
|
||||
const commentBody = comment.body?.slice(0, 500) ?? "";
|
||||
const commentBody = htmlToText(comment.body ?? "").slice(0, 500);
|
||||
const truncated = comment.body && comment.body.length > 500;
|
||||
|
||||
return buildMessage(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue