From 52f37f8514a01b0affc829ef75547249d00eee05 Mon Sep 17 00:00:00 2001 From: Arya Khochare <91268931+Aryakoste@users.noreply.github.com> Date: Wed, 12 Mar 2025 21:50:19 +0530 Subject: [PATCH] [MM-62185] Hide timezone notice for bot DMs (#30083) * Hide timezone notice for bot DMs * showRemoteUserHour to false * use_post_box_indicator test * added showRemoteUserHour in all test cases --------- Co-authored-by: Mattermost Build --- .../advanced_text_editor/use_post_box_indicator.test.tsx | 3 +++ .../advanced_text_editor/use_post_box_indicator.tsx | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/webapp/channels/src/components/advanced_text_editor/use_post_box_indicator.test.tsx b/webapp/channels/src/components/advanced_text_editor/use_post_box_indicator.test.tsx index 4fd6a3c06c..19f19c367a 100644 --- a/webapp/channels/src/components/advanced_text_editor/use_post_box_indicator.test.tsx +++ b/webapp/channels/src/components/advanced_text_editor/use_post_box_indicator.test.tsx @@ -84,6 +84,7 @@ describe('useTimePostBoxIndicator', () => { expect(current.showDndWarning).toBe(false); expect(current.isSelfDM).toBe(false); expect(current.isBot).toBe(false); + expect(current.showRemoteUserHour).toBe(true); expect(current.isScheduledPostEnabled).toBe(true); expect(current.teammateTimezone.useAutomaticTimezone).toBe(true); expect(current.teammateTimezone.automaticTimezone).toBe('IST'); @@ -96,6 +97,7 @@ describe('useTimePostBoxIndicator', () => { expect(current.showDndWarning).toBe(false); expect(current.isSelfDM).toBe(false); expect(current.isBot).toBe(true); + expect(current.showRemoteUserHour).toBe(false); expect(current.isScheduledPostEnabled).toBe(true); expect(current.teammateTimezone.useAutomaticTimezone).toBe(true); expect(current.teammateTimezone.automaticTimezone).toBe('IST'); @@ -108,6 +110,7 @@ describe('useTimePostBoxIndicator', () => { expect(current.showDndWarning).toBe(false); expect(current.isSelfDM).toBe(false); expect(current.isBot).toBe(false); + expect(current.showRemoteUserHour).toBe(true); expect(current.isScheduledPostEnabled).toBe(true); expect(current.teammateTimezone.useAutomaticTimezone).toBe(true); expect(current.teammateTimezone.automaticTimezone).toBe('IST'); diff --git a/webapp/channels/src/components/advanced_text_editor/use_post_box_indicator.tsx b/webapp/channels/src/components/advanced_text_editor/use_post_box_indicator.tsx index 089bd2b4de..e87a093dee 100644 --- a/webapp/channels/src/components/advanced_text_editor/use_post_box_indicator.tsx +++ b/webapp/channels/src/components/advanced_text_editor/use_post_box_indicator.tsx @@ -96,12 +96,12 @@ function useTimePostBoxIndicator(channelId: string) { const isScheduledPostEnabledValue = useSelector(isScheduledPostsEnabled); - const showRemoteUserHour = isDM && showIt && timestamp !== 0; - const currentUserId = useSelector(getCurrentUserId); const isSelfDM = isDM && teammateId === currentUserId; const isBot = Boolean(isDM && teammate?.is_bot); + const showRemoteUserHour = isDM && showIt && timestamp !== 0 && !isBot; + return { showRemoteUserHour, isDM,