Support changing the nick by clicking it in MessageInput
This commit is contained in:
parent
4a74463ae8
commit
f174d98107
16 changed files with 335 additions and 134 deletions
|
@ -123,18 +123,17 @@ export default createReducer(Map(), {
|
|||
});
|
||||
},
|
||||
|
||||
[actions.socket.NICK](state, action) {
|
||||
const { server } = action;
|
||||
[actions.socket.NICK](state, { server, oldNick, newNick }) {
|
||||
return state.withMutations(s => {
|
||||
s.get(server).forEach((v, channel) => {
|
||||
s.updateIn([server, channel, 'users'], users => {
|
||||
const i = users.findIndex(user => user.nick === action.old);
|
||||
const i = users.findIndex(user => user.nick === oldNick);
|
||||
if (i < 0) {
|
||||
return users;
|
||||
}
|
||||
|
||||
return users.update(i,
|
||||
user => updateRenderName(user.set('nick', action.new))
|
||||
user => updateRenderName(user.set('nick', newNick))
|
||||
).sort(compareUsers);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue