diff --git a/web/core/components/notifications/notification-card.tsx b/web/core/components/notifications/notification-card.tsx index 7c4a8313e..9b540d118 100644 --- a/web/core/components/notifications/notification-card.tsx +++ b/web/core/components/notifications/notification-card.tsx @@ -8,7 +8,6 @@ import { ArchiveRestore, Clock, MessageSquare, MoreVertical, User2 } from "lucid import { Menu } from "@headlessui/react"; // type import type { IUserNotification, NotificationType } from "@plane/types"; -// ui import { ArchiveIcon, CustomMenu, Tooltip, TOAST_TYPE, setToast } from "@plane/ui"; // constants import { @@ -20,6 +19,7 @@ import { import { snoozeOptions } from "@/constants/notification"; // helper import { calculateTimeAgo, renderFormattedTime, renderFormattedDate, getDate } from "@/helpers/date-time.helper"; +import { sanitizeCommentForNotification } from "@/helpers/notification.helper"; import { replaceUnderscoreIfSnakeCase, truncateText, stripAndTruncateHTML } from "@/helpers/string.helper"; // hooks import { useEventTracker } from "@/hooks/store"; @@ -206,11 +206,7 @@ export const NotificationCard: React.FC = (props) => { ) ) : ( - {`"`} - {notification.data.issue_activity.new_value.length > 55 - ? notification?.data?.issue_activity?.issue_comment?.slice(0, 50) + "..." - : notification.data.issue_activity.issue_comment} - {`"`} + {sanitizeCommentForNotification(notification.data.issue_activity.new_value ?? undefined)} ) ) : ( diff --git a/web/helpers/notification.helper.ts b/web/helpers/notification.helper.ts new file mode 100644 index 000000000..fbc77d21b --- /dev/null +++ b/web/helpers/notification.helper.ts @@ -0,0 +1,8 @@ +import { stripAndTruncateHTML } from "./string.helper"; + +export const sanitizeCommentForNotification = (mentionContent: string | undefined) => + mentionContent + ? stripAndTruncateHTML( + mentionContent.replace(/]*\blabel="([^"]*)"[^>]*><\/mention-component>/g, "$1") + ) + : mentionContent;