[WEB-1696] chore: rendering mention comments in notification modal (#4903)
* chore: rendering mention comments in notification modal * chore: resolved build errors * chore: updated workflow * chore: updated function name and handled the notification mention render
This commit is contained in:
parent
08c4027e77
commit
7c4c777c99
2 changed files with 10 additions and 6 deletions
|
|
@ -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<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>
|
||||
)
|
||||
) : (
|
||||
|
|
|
|||
8
web/helpers/notification.helper.ts
Normal file
8
web/helpers/notification.helper.ts
Normal file
|
|
@ -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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue