From 9ecb3e20c8d7110cad38d2a5c4a60849b729cf67 Mon Sep 17 00:00:00 2001 From: M-ZubairAhmed Date: Thu, 25 Apr 2024 07:12:31 +0000 Subject: [PATCH] Update notification_actions.jsx (#26639) Update notification_actions.jsx Co-authored-by: Mattermost Build --- .../channels/src/actions/notification_actions.jsx | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/webapp/channels/src/actions/notification_actions.jsx b/webapp/channels/src/actions/notification_actions.jsx index 446cf87493..7c2df05d0a 100644 --- a/webapp/channels/src/actions/notification_actions.jsx +++ b/webapp/channels/src/actions/notification_actions.jsx @@ -2,7 +2,6 @@ // See LICENSE.txt for license information. import {logError} from 'mattermost-redux/actions/errors'; -import {getProfilesByIds} from 'mattermost-redux/actions/users'; import {getCurrentChannel, getMyChannelMember, makeGetChannel} from 'mattermost-redux/selectors/entities/channels'; import {getConfig} from 'mattermost-redux/selectors/entities/general'; import { @@ -64,14 +63,6 @@ export function sendDesktopNotification(post, msgProps) { return {status: 'not_sent', reason: 'system_message'}; } - let userFromPost = getUser(state, post.user_id); - if (!userFromPost) { - const missingProfileResponse = await dispatch(getProfilesByIds([post.user_id])); - if (missingProfileResponse.data && missingProfileResponse.data.length) { - userFromPost = missingProfileResponse.data[0]; - } - } - let mentions = []; if (msgProps.mentions) { mentions = JSON.parse(msgProps.mentions); @@ -199,11 +190,15 @@ export function sendDesktopNotification(post, msgProps) { } const config = getConfig(state); + const userFromPost = getUser(state, post.user_id); + let username = ''; if (post.props.override_username && config.EnablePostUsernameOverride === 'true') { username = post.props.override_username; } else if (userFromPost) { username = displayUsername(userFromPost, getTeammateNameDisplaySetting(state), false); + } else if (msgProps.sender_name) { + username = msgProps.sender_name; } else { username = Utils.localizeMessage('channel_loader.someone', 'Someone'); }