Page MenuHomePhorge

No OneTemporary

Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
diff --git a/src/App.vue b/src/App.vue
index e09ce4c8f3..1a1667788d 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,67 +1,67 @@
<template>
<div
id="app"
:style="bgStyle"
>
<div
id="app_bg_wrapper"
class="app-bg-wrapper"
/>
<MobileNav v-if="isMobileLayout" />
<DesktopNav v-else />
<div class="app-bg-wrapper app-container-wrapper" />
<div
id="content"
class="container underlay"
>
<div
class="sidebar-flexer mobile-hidden"
:style="sidebarAlign"
>
<div class="sidebar-bounds">
<div class="sidebar-scroller">
<div class="sidebar">
<user-panel />
<div v-if="!isMobileLayout">
<nav-panel />
<instance-specific-panel v-if="showInstanceSpecificPanel" />
<features-panel v-if="!currentUser && showFeaturesPanel" />
<who-to-follow-panel v-if="currentUser && suggestionsEnabled" />
<notifications v-if="currentUser" />
</div>
</div>
</div>
</div>
</div>
<div class="main">
<div
v-if="!currentUser"
class="login-hint panel panel-default"
>
<router-link
:to="{ name: 'login' }"
class="panel-body"
>
{{ $t("login.hint") }}
</router-link>
</div>
<router-view />
</div>
<media-modal />
</div>
<chat-panel
- v-if="currentUser"
+ v-if="currentUser && chat"
:floating="true"
class="floating-chat mobile-hidden"
/>
<MobilePostStatusButton />
<UserReportingModal />
<PostStatusModal />
<SettingsModal />
<portal-target name="modal" />
<GlobalNoticeList />
</div>
</template>
<script src="./App.js"></script>
<style lang="scss" src="./App.scss"></style>
diff --git a/src/modules/chat.js b/src/modules/chat.js
index 264ba00b71..ffeb272b67 100644
--- a/src/modules/chat.js
+++ b/src/modules/chat.js
@@ -1,52 +1,34 @@
const chat = {
state: {
messages: [],
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')
- let id = 0
- const createmsg = () => {
- id += 1
- return {
- text: 'test' + id,
- author: {
- username: 'test',
- avatar: '',
- id
- }
- }
- }
-
- const loop = () => {
- store.commit('addMessage', createmsg())
- setTimeout(loop, 3000)
- }
- loop()
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
Fri, Oct 30, 1:35 AM (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1799120
Default Alt Text
(3 KB)

Event Timeline