diff --git a/web/modals/threads/notifications/notifications-modal.react.js b/web/modals/threads/notifications/notifications-modal.react.js --- a/web/modals/threads/notifications/notifications-modal.react.js +++ b/web/modals/threads/notifications/notifications-modal.react.js @@ -192,52 +192,56 @@ ? 'Thread notifications' : 'Channel notifications'; - let modalContent; - if (isSidebar && !parentThreadInfo?.currentUser.subscription.home) { - modalContent = ( + const noticeText = React.useMemo(() => { + if (!isSidebar) { + return null; + } + + return ( <> -

- {'It’s not possible to change the notif settings for a thread ' + - 'whose parent is in Background. That’s because Comm’s design ' + - 'always shows threads underneath their parent in the Inbox, ' + - 'which means that if a thread’s parent is in Background, the ' + - 'thread must also be there.'} +

+ {'It’s not possible to move this thread to Background. ' + + 'That’s because Comm’s design always shows threads ' + + 'underneath their parent in the Inbox, which means ' + + 'that if a thread’s parent is in Focused, the thread ' + + 'must also be there.'}

-

+

{canPromoteSidebar(threadInfo, parentThreadInfo) - ? 'If you want to change the notif settings for this thread, ' + - 'you can either change the notif settings for the parent, ' + + ? 'If you want to move this thread to Background, ' + + 'you can either move the parent to Background, ' + 'or you can promote the thread to a channel.' - : 'If you want to change the notif settings for this thread, ' + - 'you’ll have to change the notif settings for the parent.'} + : 'If you want to move this thread to Background, ' + + 'you’ll have to move the parent to Background.'}

); - } else { - let noticeText = null; - if (isSidebar) { - noticeText = ( + }, [isSidebar, parentThreadInfo, threadInfo]); + + const modalContent = React.useMemo(() => { + if (isSidebar && !parentThreadInfo?.currentUser.subscription.home) { + return ( <> -

- {'It’s not possible to move this thread to Background. ' + - 'That’s because Comm’s design always shows threads ' + - 'underneath their parent in the Inbox, which means ' + - 'that if a thread’s parent is in Focused, the thread ' + - 'must also be there.'} +

+ {'It’s not possible to change the notif settings for a thread ' + + 'whose parent is in Background. That’s because Comm’s design ' + + 'always shows threads underneath their parent in the Inbox, ' + + 'which means that if a thread’s parent is in Background, the ' + + 'thread must also be there.'}

-

+

{canPromoteSidebar(threadInfo, parentThreadInfo) - ? 'If you want to move this thread to Background, ' + - 'you can either move the parent to Background, ' + + ? 'If you want to change the notif settings for this thread, ' + + 'you can either change the notif settings for the parent, ' + 'or you can promote the thread to a channel.' - : 'If you want to move this thread to Background, ' + - 'you’ll have to move the parent to Background.'} + : 'If you want to change the notif settings for this thread, ' + + 'you’ll have to change the notif settings for the parent.'}

); } - modalContent = ( + return ( <>
{focusedItem} @@ -254,7 +258,18 @@ {noticeText} ); - } + }, [ + backgroundItem, + focusedBadgeOnlyItem, + focusedItem, + initialThreadSetting, + isSidebar, + noticeText, + notificationSettings, + onClickSave, + parentThreadInfo, + threadInfo, + ]); return (