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

Commit

Permalink
MM-24356 dispatch getChannelMemberCountsByGroup when user updates tim…
Browse files Browse the repository at this point in the history
…ezone
  • Loading branch information
fm2munsh committed Apr 20, 2020
1 parent 4e44ba9 commit 0658fbb
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions actions/websocket_actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
getChannelStats,
viewChannel,
markChannelAsRead,
getChannelMemberCountsByGroup,
} from 'mattermost-redux/actions/channels';
import {loadRolesIfNeeded} from 'mattermost-redux/actions/roles';
import {setServerVersion} from 'mattermost-redux/actions/general';
Expand Down Expand Up @@ -825,20 +826,28 @@ export async function handleUserUpdatedEvent(msg) {
const currentUser = getCurrentUser(state);
const user = msg.data.user;

if (isGuest(user)) {
const config = getConfig(state);
const isTimezoneEnabled = config.ExperimentalTimezone === 'true';
const userIsGuest = isGuest(user);
if (userIsGuest || isTimezoneEnabled) {
let members = getMembersInCurrentChannel(state);
const currentChannelId = getCurrentChannelId(state);
if (members && members[user.id]) {
dispatch(getChannelStats(currentChannelId));
} else {
if (!members || !members[user.id]) {
await dispatch(getChannelMember(currentChannelId, user.id));
members = getMembersInCurrentChannel(getState());
if (members && members[user.id]) {
}

if (members && members[user.id]) {
if (isTimezoneEnabled) {
dispatch(getChannelMemberCountsByGroup(currentChannelId, true));
}
if (isGuest(user)) {
dispatch(getChannelStats(currentChannelId));
}
}
}


if (currentUser.id === user.id) {
if (user.update_at > currentUser.update_at) {
// Need to request me to make sure we don't override with sanitized fields from the
Expand Down

0 comments on commit 0658fbb

Please sign in to comment.