mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-54356: In-correct User count when adding members that already exists to the channel (#24540)
* Only add user who isn't in the channel * Update webapp/channels/src/packages/mattermost-redux/src/actions/channels.ts Co-authored-by: Devin Binnie <52460000+devinbinnie@users.noreply.github.com> --------- Co-authored-by: Devin Binnie <52460000+devinbinnie@users.noreply.github.com> Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
parent
ccfb4a3d74
commit
d08f1ca3fb
@ -1049,20 +1049,23 @@ export function addChannelMember(channelId: string, userId: string, postRootId =
|
||||
|
||||
Client4.trackEvent('action', 'action_channels_add_member', {channel_id: channelId});
|
||||
|
||||
dispatch(batchActions([
|
||||
{
|
||||
type: UserTypes.RECEIVED_PROFILE_IN_CHANNEL,
|
||||
data: {id: channelId, user_id: userId},
|
||||
},
|
||||
{
|
||||
type: ChannelTypes.RECEIVED_CHANNEL_MEMBER,
|
||||
data: member,
|
||||
},
|
||||
{
|
||||
type: ChannelTypes.ADD_CHANNEL_MEMBER_SUCCESS,
|
||||
id: channelId,
|
||||
},
|
||||
], 'ADD_CHANNEL_MEMBER.BATCH'));
|
||||
const membersInChannel = getState().entities.channels.membersInChannel[channelId];
|
||||
if (!(membersInChannel && userId in membersInChannel)) {
|
||||
dispatch(batchActions([
|
||||
{
|
||||
type: UserTypes.RECEIVED_PROFILE_IN_CHANNEL,
|
||||
data: {id: channelId, user_id: userId},
|
||||
},
|
||||
{
|
||||
type: ChannelTypes.RECEIVED_CHANNEL_MEMBER,
|
||||
data: member,
|
||||
},
|
||||
{
|
||||
type: ChannelTypes.ADD_CHANNEL_MEMBER_SUCCESS,
|
||||
id: channelId,
|
||||
},
|
||||
], 'ADD_CHANNEL_MEMBER.BATCH'));
|
||||
}
|
||||
|
||||
return {data: member};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user