Fix handling of PART messages with no reason

This commit is contained in:
Ken-Håvard Lieng 2017-04-04 22:57:01 +02:00
parent 52f929ec45
commit 50dc0ef64f
6 changed files with 56 additions and 41 deletions

View file

@ -85,8 +85,7 @@ export default createReducer(Map(), {
},
[actions.SOCKET_PART](state, action) {
const { server, channels, user } = action;
const channel = channels[0];
const { server, channel, user } = action;
if (state.hasIn([server, channel])) {
return state.updateIn([server, channel, 'users'], users =>
users.filter(u => u.nick !== user)

View file

@ -45,8 +45,8 @@ export default function handleSocket(socket, { dispatch, getState }) {
dispatch(inform(`${user} joined the channel`, server, channels[0]))
);
socket.on('part', ({ user, server, channels, reason }) =>
dispatch(inform(withReason(`${user} left the channel`, reason), server, channels[0]))
socket.on('part', ({ user, server, channel, reason }) =>
dispatch(inform(withReason(`${user} left the channel`, reason), server, channel))
);
socket.on('quit', ({ user, server, reason, channels }) =>