fixed bugs when changing channels

This commit is contained in:
unknown 2019-12-11 20:00:47 +00:00
parent cedb8245d4
commit 1b6a788d1b
4 changed files with 6 additions and 23 deletions

View file

@ -98,27 +98,7 @@ export default {
this.dismissNotification(channel.channelID); this.dismissNotification(channel.channelID);
this.$store.dispatch("servers/setSelectedServerID", serverID); this.$store.dispatch("servers/setSelectedServerID", serverID);
this.$store.dispatch("openChannel", channel); this.$store.dispatch("openChannel", channel);
}, this.$store.dispatch("selectedChannelID", channel.channelID);
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);
}
}, },
switchTab(index) { switchTab(index) {
bus.$emit('tab:switch', index) bus.$emit('tab:switch', index)

View file

@ -73,9 +73,8 @@
class="about-item-container" class="about-item-container"
v-for="(aboutItem) of aboutMe" v-for="(aboutItem) of aboutMe"
:key="aboutItem.name" :key="aboutItem.name"
:class="{infoAboutMe: aboutItem.key === 'About me'}"
> >
<div class="about-item" v-if="aboutMe"> <div class="about-item" v-if="aboutMe" :class="{infoAboutMe: aboutItem.key === 'About me'}">
<div class="key">{{aboutItem.key}}:</div> <div class="key">{{aboutItem.key}}:</div>
<div class="emoji" v-if="aboutItem.emoji" v-html="aboutItem.emoji"></div> <div class="emoji" v-if="aboutItem.emoji" v-html="aboutItem.emoji"></div>
<SimpleMarkdown class="name" v-if="aboutItem.key === 'About me'" :message="aboutItem.name" /> <SimpleMarkdown class="name" v-if="aboutItem.key === 'About me'" :message="aboutItem.name" />

View file

@ -60,6 +60,7 @@ export default {
bus.$emit('closeLeftMenu'); bus.$emit('closeLeftMenu');
this.$store.dispatch('openChannel', channel) this.$store.dispatch('openChannel', channel)
this.$store.dispatch("selectedChannelID", channel.channelID);
} }
}, },
async beforeMount() { async beforeMount() {

View file

@ -161,6 +161,9 @@ async function getMessages(context, channelID, isServerChannel) {
channelID: result.data.channelID, channelID: result.data.channelID,
messages: result.data.messages.reverse() messages: result.data.messages.reverse()
}); });
if (isServerChannel) {
context.commit("setServerChannelID", result.data.channelID);
}
} else { } else {
// TODO handle this // TODO handle this
console.log(error.response); console.log(error.response);