Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
Handle user updated event for profile image change for current user (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilander authored and hmhealey committed Aug 28, 2020
1 parent 1cceec0 commit f74e4e1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/mattermost-redux/src/actions/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
import {General, WebsocketEvents, Preferences, Posts} from 'constants';

import {getCurrentChannelStats} from 'selectors/entities/channels';
import {getCurrentUser} from 'selectors/entities/users';
import {getUserIdFromChannelName} from 'utils/channel_utils';
import {isFromWebhook, isSystemMessage, getLastCreateAt, shouldIgnorePost} from 'utils/post_utils';
import EventEmitter from 'utils/event_emitter';
Expand Down Expand Up @@ -433,11 +434,18 @@ function handleUserRemovedEvent(msg, dispatch, getState) {
}

function handleUserUpdatedEvent(msg, dispatch, getState) {
const entities = getState().entities;
const {currentUserId} = entities.users;
const currentUser = getCurrentUser(getState());
const user = msg.data.user;

if (user.id !== currentUserId) {
if (user.id === currentUser.id) {
dispatch({
type: UserTypes.RECEIVED_ME,
data: {
...currentUser,
last_picture_update: user.last_picture_update
}
});
} else {
dispatch({
type: UserTypes.RECEIVED_PROFILES,
data: {
Expand Down

0 comments on commit f74e4e1

Please sign in to comment.