Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3300212
D10282.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D10282.diff
View Options
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 (
<>
- <p>
- {'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.'}
+ <p className={css.notice}>
+ {'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.'}
</p>
- <p>
+ <p className={css.notice}>
{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.'}
</p>
</>
);
- } else {
- let noticeText = null;
- if (isSidebar) {
- noticeText = (
+ }, [isSidebar, parentThreadInfo, threadInfo]);
+
+ const modalContent = React.useMemo(() => {
+ if (isSidebar && !parentThreadInfo?.currentUser.subscription.home) {
+ return (
<>
- <p className={css.notice}>
- {'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.'}
+ <p>
+ {'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.'}
</p>
- <p className={css.notice}>
+ <p>
{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.'}
</p>
</>
);
}
- modalContent = (
+ return (
<>
<div className={css.optionsContainer}>
{focusedItem}
@@ -254,7 +258,18 @@
{noticeText}
</>
);
- }
+ }, [
+ backgroundItem,
+ focusedBadgeOnlyItem,
+ focusedItem,
+ initialThreadSetting,
+ isSidebar,
+ noticeText,
+ notificationSettings,
+ onClickSave,
+ parentThreadInfo,
+ threadInfo,
+ ]);
return (
<Modal name={modalName} size="fit-content" onClose={onClose}>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 18, 6:47 PM (19 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2535459
Default Alt Text
D10282.diff (4 KB)
Attached To
Mode
D10282: [web] cleanup thread notifications modal rendering logic
Attached
Detach File
Event Timeline
Log In to Comment