Fix race condition with NICK and QUIT when multiple dispatch users are in the same channel
This commit is contained in:
parent
3393b1b706
commit
18651c1a10
8 changed files with 145 additions and 138 deletions
|
@ -104,15 +104,15 @@ export default createReducer(Map(), {
|
|||
},
|
||||
|
||||
[actions.SOCKET_NICK](state, action) {
|
||||
const { server, channels } = action;
|
||||
const { server } = action;
|
||||
return state.withMutations(s => {
|
||||
channels.forEach(channel => {
|
||||
s.updateIn([server, channel, 'users'], users => {
|
||||
const i = users.findIndex(user => user.nick === action.old);
|
||||
return users.update(i, user =>
|
||||
updateRenderName(user.set('nick', action.new))
|
||||
).sort(compareUsers);
|
||||
});
|
||||
s.get(server).forEach((v, channel) => {
|
||||
s.updateIn([server, channel, 'users'], users =>
|
||||
users.update(
|
||||
users.findIndex(user => user.nick === action.old),
|
||||
user => updateRenderName(user.set('nick', action.new))
|
||||
).sort(compareUsers)
|
||||
);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue