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.$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)

View file

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

View file

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

View file

@ -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);