From fc15ca5565450cf88a75f861de5a1a8a84a10e45 Mon Sep 17 00:00:00 2001 From: guru_sainath Date: Tue, 2 Jul 2024 18:49:40 +0530 Subject: [PATCH] [WEB-1792] fix: handled redirection issue when we change the status of the inbox issue in the notification (#5014) * fix: handled redirection issue when we change the status of inbox issue in notification * fix: updated condition --- .../inbox/content/inbox-issue-header.tsx | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/web/core/components/inbox/content/inbox-issue-header.tsx b/web/core/components/inbox/content/inbox-issue-header.tsx index 9c46a3109..a7302005a 100644 --- a/web/core/components/inbox/content/inbox-issue-header.tsx +++ b/web/core/components/inbox/content/inbox-issue-header.tsx @@ -101,11 +101,13 @@ export const InboxIssueActionsHeader: FC = observer((p }; const handleRedirection = (nextOrPreviousIssueId: string | undefined) => { - if (nextOrPreviousIssueId) - router.push( - `/${workspaceSlug}/projects/${projectId}/inbox?currentTab=${currentTab}&inboxIssueId=${nextOrPreviousIssueId}` - ); - else router.push(`/${workspaceSlug}/projects/${projectId}/inbox?currentTab=${currentTab}`); + if (!isNotificationEmbed) { + if (nextOrPreviousIssueId) + router.push( + `/${workspaceSlug}/projects/${projectId}/inbox?currentTab=${currentTab}&inboxIssueId=${nextOrPreviousIssueId}` + ); + else router.push(`/${workspaceSlug}/projects/${projectId}/inbox?currentTab=${currentTab}`); + } }; const handleInboxIssueAccept = async () => { @@ -136,7 +138,7 @@ export const InboxIssueActionsHeader: FC = observer((p const handleInboxIssueDelete = async () => { if (!inboxIssue || !currentInboxIssueId) return; await deleteInboxIssue(workspaceSlug, projectId, currentInboxIssueId).finally(() => { - router.push(`/${workspaceSlug}/projects/${projectId}/inbox`); + if (!isNotificationEmbed) router.push(`/${workspaceSlug}/projects/${projectId}/inbox`); }); }; @@ -189,11 +191,11 @@ export const InboxIssueActionsHeader: FC = observer((p ); useEffect(() => { - document.addEventListener("keydown", onKeyDown); + if (!isNotificationEmbed) document.addEventListener("keydown", onKeyDown); return () => { - document.removeEventListener("keydown", onKeyDown); + if (!isNotificationEmbed) document.removeEventListener("keydown", onKeyDown); }; - }, [onKeyDown]); + }, [onKeyDown, isNotificationEmbed]); if (!inboxIssue) return null;