From 1b6a788d1b08729ccc46330152de87f7e62379f2 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Dec 2019 20:00:47 +0000 Subject: [PATCH] fixed bugs when changing channels --- src/components/app/Navigation.vue | 22 +------------------ .../Popouts/Popouts/userInformationPopout.vue | 3 +-- .../app/ServerTemplate/ChannelsList.vue | 1 + src/store/modules/messageModule.js | 3 +++ 4 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/components/app/Navigation.vue b/src/components/app/Navigation.vue index 6c25552..83f716b 100644 --- a/src/components/app/Navigation.vue +++ b/src/components/app/Navigation.vue @@ -98,27 +98,7 @@ export default { this.dismissNotification(channel.channelID); this.$store.dispatch("servers/setSelectedServerID", serverID); this.$store.dispatch("openChannel", channel); - }, - switchChannel(isServer) { - const serverChannelID = this.$store.state.channelModule.serverChannelID; - const DMChannelID = this.$store.state.channelModule.DMChannelID; - - if (isServer) { - this.$store.dispatch("selectedChannelID", serverChannelID); - const channel = this.$store.state.channelModule.channels[ - serverChannelID - ]; - this.$store.dispatch("setChannelName", channel ? channel.name : ""); - this.dismissNotification(serverChannelID); - } else { - const channel = this.$store.state.channelModule.channels[DMChannelID]; - this.$store.dispatch( - "setChannelName", - channel ? channel.recipients[0].username : "" - ); - this.$store.dispatch("selectedChannelID", DMChannelID); - this.dismissNotification(DMChannelID); - } + this.$store.dispatch("selectedChannelID", channel.channelID); }, switchTab(index) { bus.$emit('tab:switch', index) diff --git a/src/components/app/Popouts/Popouts/userInformationPopout.vue b/src/components/app/Popouts/Popouts/userInformationPopout.vue index 7717f8a..3e0b68d 100644 --- a/src/components/app/Popouts/Popouts/userInformationPopout.vue +++ b/src/components/app/Popouts/Popouts/userInformationPopout.vue @@ -73,9 +73,8 @@ class="about-item-container" v-for="(aboutItem) of aboutMe" :key="aboutItem.name" - :class="{infoAboutMe: aboutItem.key === 'About me'}" > -
+
{{aboutItem.key}}:
diff --git a/src/components/app/ServerTemplate/ChannelsList.vue b/src/components/app/ServerTemplate/ChannelsList.vue index 09f42ed..85c3305 100644 --- a/src/components/app/ServerTemplate/ChannelsList.vue +++ b/src/components/app/ServerTemplate/ChannelsList.vue @@ -60,6 +60,7 @@ export default { bus.$emit('closeLeftMenu'); this.$store.dispatch('openChannel', channel) + this.$store.dispatch("selectedChannelID", channel.channelID); } }, async beforeMount() { diff --git a/src/store/modules/messageModule.js b/src/store/modules/messageModule.js index 738f2cd..ccd2c76 100644 --- a/src/store/modules/messageModule.js +++ b/src/store/modules/messageModule.js @@ -161,6 +161,9 @@ async function getMessages(context, channelID, isServerChannel) { channelID: result.data.channelID, messages: result.data.messages.reverse() }); + if (isServerChannel) { + context.commit("setServerChannelID", result.data.channelID); + } } else { // TODO handle this console.log(error.response);