diff options
| author | Henry Jameson <me@hjkos.com> | 2019-03-21 22:28:29 +0200 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2019-03-21 22:28:29 +0200 |
| commit | fe13b1b75a42d03a813072633194f89385acec8e (patch) | |
| tree | 04db79c750a98dffa62df7338c82486b971915d2 /src/modules/chat.js | |
| parent | c038d0c12a8cc2af9fd3d3c6f9e338ee0d7c4765 (diff) | |
| parent | 66e60572bc5f3f35a902417547c1d38e3665fbb7 (diff) | |
Merge remote-tracking branch 'upstream/develop' into mastoapi/friends-tl
* 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) }) |
