diff options
| author | Henry Jameson <me@hjkos.com> | 2019-03-21 22:40:20 +0200 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2019-03-21 22:40:20 +0200 |
| commit | 307b4ba698fd87b3a6cabbe18a1f78513d414e33 (patch) | |
| tree | 1e16e661853db0f8ed04a01712cf0d67c653f17b /src/modules/chat.js | |
| parent | 49b0f0a04a74039a1b82fbde731828e599123e93 (diff) | |
| parent | 66e60572bc5f3f35a902417547c1d38e3665fbb7 (diff) | |
Merge remote-tracking branch 'upstream/develop' into mastoapi/convos
* upstream/develop: (47 commits)
#449 - fix auth token fetch issue
Make select tag use --inputText as text color
#444 - remote follow clean up
#444 - show `remote follow` button when logged out
Add button to save without cropping
post-merge fixes
[i18n] Update oc.json
after store: fix setting postFormats field
fix user-card avatar falling into permament failed state
fix flake id users not fetching correctly
fix console error
afterStoreSetup: Move log in and theme load to afterStoreSetup.
afterStoreSetup: Handle 404 cases.
afterStoreSetup: Emoji and nodeinfo refactor.
afterStoreSetup: refactor TOS and panel fetching, handle 404s.
afterStoreSetup: refactor.
Load persistedStated with async/await.
whoops
レインせんぱいにサンキュー
fix embedded relationship card parsing
...
Diffstat (limited to 'src/modules/chat.js')
| -rw-r--r-- | src/modules/chat.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/modules/chat.js b/src/modules/chat.js index 383ac75c..2804e577 100644 --- a/src/modules/chat.js +++ b/src/modules/chat.js @@ -1,12 +1,16 @@ const chat = { state: { messages: [], - channel: {state: ''} + channel: {state: ''}, + socket: null }, mutations: { setChannel (state, channel) { state.channel = channel }, + setSocket (state, socket) { + state.socket = socket + }, addMessage (state, message) { state.messages.push(message) state.messages = state.messages.slice(-19, 20) @@ -16,8 +20,12 @@ const chat = { } }, actions: { + disconnectFromChat (store) { + store.state.socket.disconnect() + }, initializeChat (store, socket) { const channel = socket.channel('chat:public') + store.commit('setSocket', socket) channel.on('new_msg', (msg) => { store.commit('addMessage', msg) }) |
