From 6a0ea3a5a373d11d863f8c8145047cff84ab6fa3 Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Fri, 16 Oct 2020 16:03:32 -0400 Subject: [PATCH] Fix check for going between discussion pages. The current implementation for checking whether we are on a discussion page, and going to a discussion page, checks the route we are going to. This is problematic, because the route resolver represents the route being considered, not the route we are currently on. So, if we are currently using a DiscussionPageResolver, we must be going to a route handled by DiscussionPage. Instead, we need to check the route that we are currently on, which is done via `app.current.matches(DiscussionPage)`. --- .../core/js/src/forum/resolvers/DiscussionPageResolver.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/core/js/src/forum/resolvers/DiscussionPageResolver.ts b/framework/core/js/src/forum/resolvers/DiscussionPageResolver.ts index 56ce0f597..6d4e64d63 100644 --- a/framework/core/js/src/forum/resolvers/DiscussionPageResolver.ts +++ b/framework/core/js/src/forum/resolvers/DiscussionPageResolver.ts @@ -1,4 +1,5 @@ import DefaultResolver from '../../common/resolvers/DefaultResolver'; +import DiscussionPage from '../components/DiscussionPage'; /** * This isn't exported as it is a temporary measure. @@ -27,7 +28,7 @@ export default class DiscussionPageResolver extends DefaultResolver { } onmatch(args, requestedPath, route) { - if (route.includes('/d/:id') && getDiscussionIdFromSlug(args.id) === getDiscussionIdFromSlug(m.route.param('id'))) { + if (app.current.matches(DiscussionPage) && getDiscussionIdFromSlug(args.id) === getDiscussionIdFromSlug(m.route.param('id'))) { DiscussionPageResolver.scrollToPostNumber = args.near === 'reply' ? 'reply' : parseInt(args.near); }