From 897f238c387d9ea6d86a87c219e40051631ffe70 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Fri, 8 Nov 2019 12:56:18 +0000 Subject: [PATCH] Disallow navigating to invalid channels --- client/js/router.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/js/router.js b/client/js/router.js index 76ca05a8..1b0ac3d6 100644 --- a/client/js/router.js +++ b/client/js/router.js @@ -40,6 +40,12 @@ router.beforeEach((to, from, next) => { return; } + // Disallow navigating to invalid channels + if (to.name === "RoutedChat" && !store.getters.findChannel(Number(to.params.pathMatch))) { + next(false); + return; + } + // Handle closing image viewer with the browser back button if (!router.app.$refs.app) { next();