Page MenuHomePhorge

No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None
diff --git a/src/App.js b/src/App.js
index 0636c47dbc..8e7acb4228 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,40 +1,40 @@
import UserPanel from './components/user_panel/user_panel.vue'
import NavPanel from './components/nav_panel/nav_panel.vue'
import Notifications from './components/notifications/notifications.vue'
import UserFinder from './components/user_finder/user_finder.vue'
import ChatPanel from './components/chat_panel/chat_panel.vue'
export default {
name: 'app',
components: {
UserPanel,
NavPanel,
Notifications,
UserFinder,
ChatPanel
},
data: () => ({
mobileActivePanel: 'timeline'
}),
computed: {
currentUser () { return this.$store.state.users.currentUser },
background () {
return this.currentUser.background_image || this.$store.state.config.background
},
logoStyle () { return { 'background-image': `url(${this.$store.state.config.logo})` } },
style () { return { 'background-image': `url(${this.background})` } },
sitename () { return this.$store.state.config.name },
- chat () { return this.$store.state.chat.channel }
+ chat () { return this.$store.state.chat.channel.state === 'joined' }
},
methods: {
activatePanel (panelName) {
this.mobileActivePanel = panelName
},
scrollToTop () {
window.scrollTo(0, 0)
},
logout () {
this.$store.dispatch('logout')
}
}
}
diff --git a/src/modules/chat.js b/src/modules/chat.js
index b1244ebee0..383ac75c23 100644
--- a/src/modules/chat.js
+++ b/src/modules/chat.js
@@ -1,33 +1,33 @@
const chat = {
state: {
messages: [],
- channel: null
+ channel: {state: ''}
},
mutations: {
setChannel (state, channel) {
state.channel = channel
},
addMessage (state, message) {
state.messages.push(message)
state.messages = state.messages.slice(-19, 20)
},
setMessages (state, messages) {
state.messages = messages.slice(-19, 20)
}
},
actions: {
initializeChat (store, socket) {
const channel = socket.channel('chat:public')
channel.on('new_msg', (msg) => {
store.commit('addMessage', msg)
})
channel.on('messages', ({messages}) => {
store.commit('setMessages', messages)
})
channel.join()
store.commit('setChannel', channel)
}
}
}
export default chat

File Metadata

Mime Type
text/x-diff
Expires
Sun, Aug 9, 3:08 AM (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1724151
Default Alt Text
(2 KB)

Event Timeline