Commit bd6c446b authored by lain's avatar lain

Merge branch 'fix/dont-connect-ws-when-chat-disabled' into 'develop'

fix #288 - Don't connect WS when chat is disabled

Closes #288

See merge request pleroma/pleroma-fe!492
parents 0e5fe750 41c4d593
......@@ -89,6 +89,8 @@ const afterStoreSetup = ({ store, i18n }) => {
if ((config.chatDisabled)) {
store.dispatch('disableChat')
} else {
store.dispatch('initializeSocket')
}
const router = new VueRouter({
......
......@@ -20,6 +20,9 @@ const api = {
removeFetcher (state, {timeline}) {
delete state.fetchers[timeline]
},
setWsToken (state, token) {
state.wsToken = token
},
setSocket (state, socket) {
state.socket = socket
},
......@@ -51,10 +54,14 @@ const api = {
window.clearInterval(fetcher)
store.commit('removeFetcher', {timeline})
},
initializeSocket (store, token) {
setWsToken (store, token) {
store.commit('setWsToken', token)
},
initializeSocket (store) {
// Set up websocket connection
if (!store.state.chatDisabled) {
let socket = new Socket('/socket', {params: {token: token}})
const token = store.state.wsToken
const socket = new Socket('/socket', {params: {token}})
socket.connect()
store.dispatch('initializeChat', socket)
}
......
......@@ -224,10 +224,10 @@ const users = {
commit('setBackendInteractor', backendInteractorService(accessToken))
if (user.token) {
store.dispatch('initializeSocket', user.token)
store.dispatch('setWsToken', user.token)
}
// Start getting fresh tweets.
// Start getting fresh posts.
store.dispatch('startFetching', 'friends')
// Get user mutes and follower info
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment