sdelements / lets-chat

Self-hosted chat app for small teams
http://sdelements.github.io/lets-chat
MIT License
9.76k stars 1.58k forks source link

Storage of joined channels not in localStorage but on server side (mongodb) #714

Closed digination closed 7 years ago

digination commented 7 years ago

Hi, IMO the information for joined channels must not remain in the client's localStrage because it lacks persistency, and the information isn't preserved when the user uses another terminal/browser.

Regards, Clément.

hhaidar commented 7 years ago

+1

digination commented 7 years ago

In the model , the user object has a rooms list attribute but oddly enough it remains empty even when the user has joined some rooms ( /rooms/id/users has the correct entries though) Would it be a good plan to fill this list to get persistency ?

The other option would be to create a new object in the model: joinded_rooms(uid, rooms [] ) but that would be kinda redundant..

digination commented 7 years ago

Can i get a head's up from the main maintainers about that ? i'd like to start coding but i'd also like my PR to pass without problem ;)

hhaidar commented 7 years ago

@digination rooms is supposed to act as a sort of foreign key, but is not used. I'm not opposed to adding a 'joinedRooms' property though!

digination commented 7 years ago

Ok, i've written something that works: Staask/lets-chat@2363918 . Thought i'm a bit unconfortable with the use of account:profile to update the rooms field. I tried with 'users:update' socket emiting but the call didn't get the user object updated in backend.. Tell me what you think and if there are things to change before i trigger the PR.

Thank you, Clément.