From 678ac22c79c499f70335b1e919c7ac60e92a80d4 Mon Sep 17 00:00:00 2001 From: Andrew Delph Date: Fri, 27 Oct 2023 07:12:55 -0400 Subject: [PATCH] getChannelAndMyMember to load profiles for new channel (#25127) ws preferences change event load profiles for GM on GM show getChannelAndMyMember user Promise.all remove changes in getChannelAndMyMember seperate perfence changes by DM and GM instead of load both --- .../channels/src/actions/websocket_actions.jsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/webapp/channels/src/actions/websocket_actions.jsx b/webapp/channels/src/actions/websocket_actions.jsx index 2999b3f798..254c0bbafe 100644 --- a/webapp/channels/src/actions/websocket_actions.jsx +++ b/webapp/channels/src/actions/websocket_actions.jsx @@ -101,7 +101,7 @@ import {sendDesktopNotification} from 'actions/notification_actions.jsx'; import {handleNewPost} from 'actions/post_actions'; import * as StatusActions from 'actions/status_actions'; import {setGlobalItem} from 'actions/storage'; -import {loadProfilesForSidebar} from 'actions/user_actions'; +import {loadProfilesForDM, loadProfilesForGM} from 'actions/user_actions'; import {syncPostsInChannel} from 'actions/views/channel'; import {setGlobalDraft, transformServerDraft} from 'actions/views/drafts'; import {openModal} from 'actions/views/modals'; @@ -1233,7 +1233,11 @@ function handlePreferenceChangedEvent(msg) { dispatch({type: PreferenceTypes.RECEIVED_PREFERENCES, data: [preference]}); if (addedNewDmUser(preference)) { - loadProfilesForSidebar(); + loadProfilesForDM(); + } + + if (addedNewGmUser(preference)) { + loadProfilesForGM(); } } @@ -1242,7 +1246,11 @@ function handlePreferencesChangedEvent(msg) { dispatch({type: PreferenceTypes.RECEIVED_PREFERENCES, data: preferences}); if (preferences.findIndex(addedNewDmUser) !== -1) { - loadProfilesForSidebar(); + loadProfilesForDM(); + } + + if (preferences.findIndex(addedNewGmUser) !== -1) { + loadProfilesForGM(); } } @@ -1255,6 +1263,10 @@ function addedNewDmUser(preference) { return preference.category === Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW && preference.value === 'true'; } +function addedNewGmUser(preference) { + return preference.category === Constants.Preferences.CATEGORY_GROUP_CHANNEL_SHOW && preference.value === 'true'; +} + function handleStatusChangedEvent(msg) { dispatch({ type: UserTypes.RECEIVED_STATUSES,