Fix Vue error when navigating to channels via InlineChannel.

This commit is contained in:
Richard Lewis 2019-11-23 15:18:44 +00:00 committed by Pavel Djundik
parent 2a6c57abaa
commit 0c49f025b4

View File

@ -64,7 +64,7 @@ router.beforeEach((to, from, next) => {
next(); next();
}); });
router.afterEach(() => { router.afterEach((to) => {
if (store.state.appLoaded) { if (store.state.appLoaded) {
if (window.innerWidth <= constants.mobileViewportPixels) { if (window.innerWidth <= constants.mobileViewportPixels) {
store.commit("sidebarOpen", false); store.commit("sidebarOpen", false);
@ -73,7 +73,10 @@ router.afterEach(() => {
if (store.state.activeChannel) { if (store.state.activeChannel) {
const channel = store.state.activeChannel.channel; const channel = store.state.activeChannel.channel;
if (to.name !== "RoutedChat") {
store.commit("activeChannel", null); store.commit("activeChannel", null);
}
// When switching out of a channel, mark everything as read // When switching out of a channel, mark everything as read
if (channel.messages.length > 0) { if (channel.messages.length > 0) {