From 8aff99761aec7cb1b9ad14c99a88c41ef3add11f Mon Sep 17 00:00:00 2001 From: David Taylor Date: Wed, 5 Dec 2018 18:29:54 +0000 Subject: [PATCH] FIX: Ignore query parameters when displaying counter on internal links This matches the server-side behaviour, so that the links display counters correctly --- app/assets/javascripts/discourse/widgets/post-cooked.js.es6 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/assets/javascripts/discourse/widgets/post-cooked.js.es6 b/app/assets/javascripts/discourse/widgets/post-cooked.js.es6 index bbbf95d2755..bf3a323752a 100644 --- a/app/assets/javascripts/discourse/widgets/post-cooked.js.es6 +++ b/app/assets/javascripts/discourse/widgets/post-cooked.js.es6 @@ -104,6 +104,11 @@ export default class PostCooked { valid = href.indexOf(lc.url) >= 0; } + // Match server-side behaviour for internal links with query params + if (lc.internal && /\?/.test(href)) { + valid = href.split("?")[0] === lc.url; + } + // don't display badge counts on category badge & oneboxes (unless when explicitely stated) if (valid && isValidLink($link)) { const title = I18n.t("topic_map.clicks", { count: lc.clicks });