π₯π₯π₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.
TypeScript boardsbug-trackerdjangodockerganttissue-trackerjirajira-alternativekanbanlinearpostgresqlproduct-managementproject-managementproject-planningpythonreactredistypesciptvitework-management
[WEB-1696] chore: rendering mention comments in notification modal (#4903)
guru_sainath7c4c777c99b2
diff --git a/web/core/components/notifications/notification-card.tsx b/web/core/components/notifications/notification-card.tsxindex 7c4a8313ec..9b540d1185 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 "lucidimport { Menu } from "@headlessui/react";// typeimport type { IUserNotification, NotificationType } from "@plane/types";-// uiimport { ArchiveIcon, CustomMenu, Tooltip, TOAST_TYPE, setToast } from "@plane/ui";// constantsimport {@@ -20,6 +19,7 @@ import {import { snoozeOptions } from "@/constants/notification";// helperimport { calculateTimeAgo, renderFormattedTime, renderFormattedDate, getDate } from "@/helpers/date-time.helper";+import { sanitizeCommentForNotification } from "@/helpers/notification.helper";import { replaceUnderscoreIfSnakeCase, truncateText, stripAndTruncateHTML } from "@/helpers/string.helper";// hooksimport { useEventTracker } from "@/hooks/store";@@ -206,11 +206,7 @@ export const NotificationCard: React.FC<NotificationCardProps> = (props) => {)) : (<span>- {`"`}- {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)}</span>)) : (diff --git a/web/helpers/notification.helper.ts b/web/helpers/notification.helper.tsnew file mode 100644index 0000000000..fbc77d21bf--- /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(/<mention-component\b[^>]*\blabel="([^"]*)"[^>]*><\/mention-component>/g, "$1")+ )+ : mentionContent;