Only connect to chat upon authenticating #1936

Closed
slice wants to merge 0 commits from gitlab-mr-iid-666 into develop
Member

hello! this is my first time contributing to pleroma, so please be aware

something i noticed while using pleroma is that if you are logged out, then cryptic websocket errors get outputted to the console (as outlined in #403). (this only happens with pleroma instances that have chat enabled.)

while checking the code, it appears that p-fe makes a connection to the chat channel if chat is enabled, even if we aren't logged in. this patch adds a secondary condition that enforces the existence of a websocket token before attempting to connect to chat. this patch only creates a connection to the chat channel upon authenticating. the websocket token is only set upon verifying credentials, so:

this means that only logged in users are ever able to see chat, but i'm sure that's the intended behavior... right?

hello! this is my first time contributing to pleroma, so please be aware something i noticed while using pleroma is that if you are logged out, then cryptic websocket errors get outputted to the console (as outlined in #403). (this only happens with pleroma instances that have chat enabled.) while checking the code, it appears that p-fe makes a connection to the chat channel if chat is enabled, even if we aren't logged in. ~~this patch adds a secondary condition that enforces the existence of a websocket token before attempting to connect to chat.~~ this patch only creates a connection to the chat channel upon authenticating. the websocket token is only set upon verifying credentials, so: this means that only logged in users are ever able to see chat, but i'm sure that's the intended behavior... right?
Member

nice MR number

nice MR number
Member

yes, however this will probably just disable chat even if it's enabled since this part of code only executed once. I'd move the whole store.dispatch('initializeSocket') into place that gets executed when user logs in (or after credentials are being verified, same thing)

yes, however this will probably just disable chat even if it's enabled since this part of code only executed once. I'd move the whole `store.dispatch('initializeSocket')` into place that gets executed when user logs in (or after credentials are being verified, same thing)
Author
Member

okay, but that will require extra logic to tear down the chat socket when logging out. this is because the current behavior is to create the socket upon page load. when creating upon login, it's possible to "duplicate" the channel by logging out and logging back in

okay, but that will require extra logic to tear down the chat socket when logging out. this is because the current behavior is to create the socket upon page load. when creating upon login, it's possible to "duplicate" the channel by logging out and logging back in

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
pleroma/pleroma-fe!1936
No description provided.