logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: bfc7b6af8f3ab91ced3a5287442071637e19a34d
parent 0e56ac1c2ba198cd6c91586803758ed0e88cab38
Author: HJ <30-hj@users.noreply.git.pleroma.social>
Date:   Thu,  7 Apr 2022 07:01:09 +0000

Merge branch 'from/develop/tusooa/1156-vue3-shoutbox' into 'develop'

Fix no reactivity on vuex 4 values

Closes #1156

See merge request pleroma/pleroma-fe!1505

Diffstat:

Msrc/App.js2+-
Msrc/components/side_drawer/side_drawer.js2+-
Msrc/modules/shout.js15++++++++++++++-
3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/App.js b/src/App.js @@ -65,7 +65,7 @@ export default { } } }, - shout () { return this.$store.state.shout.channel.state === 'joined' }, + shout () { return this.$store.state.shout.joined }, suggestionsEnabled () { return this.$store.state.instance.suggestionsEnabled }, showInstanceSpecificPanel () { return this.$store.state.instance.showInstanceSpecificPanel && diff --git a/src/components/side_drawer/side_drawer.js b/src/components/side_drawer/side_drawer.js @@ -49,7 +49,7 @@ const SideDrawer = { currentUser () { return this.$store.state.users.currentUser }, - shout () { return this.$store.state.shout.channel.state === 'joined' }, + shout () { return this.$store.state.shout.joined }, unseenNotifications () { return unseenNotificationsFromStore(this.$store) }, diff --git a/src/modules/shout.js b/src/modules/shout.js @@ -1,7 +1,8 @@ const shout = { state: { messages: [], - channel: { state: '' } + channel: { state: '' }, + joined: false }, mutations: { setChannel (state, channel) { @@ -13,11 +14,23 @@ const shout = { }, setMessages (state, messages) { state.messages = messages.slice(-19, 20) + }, + setJoined (state, joined) { + state.joined = joined } }, actions: { initializeShout (store, socket) { const channel = socket.channel('chat:public') + channel.joinPush.receive('ok', () => { + store.commit('setJoined', true) + }) + channel.onClose(() => { + store.commit('setJoined', false) + }) + channel.onError(() => { + store.commit('setJoined', false) + }) channel.on('new_msg', (msg) => { store.commit('addMessage', msg) })