Skip to content

Commit f332537

Browse files
author
robflop
committed
Fix user storage hopefully
1 parent f60c840 commit f332537

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/server.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ const events = {
143143
}
144144

145145
if (!channelData.error) {
146+
user.channels[channel.name] = channel;
147+
users[user.username].channels = user.channels;
148+
146149
channels.hasOwnProperty(channel.name)
147150
? channels[channel.name].users[user.username] = user
148151
: channels[channel.name] = { name: channel.name, users: { [user.username]: user }, messages: [] };
@@ -201,6 +204,8 @@ const events = {
201204
if (!channelData.error) {
202205
channelData.channels.push(channels[channel.name] || { name: channel.name, users: { [user.username]: user }, messages: [] });
203206
// either the channel itself or an empty one if it was just deleted
207+
delete user.channels[channel.name];
208+
users[user.username].channels = user.channels;
204209

205210
const systemMessage = {
206211
content: `<b>${user.username}</b> has left.`,

0 commit comments

Comments
 (0)