From 92a9ae6ab028dbbebaa2cb2a96d804700faad9b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Wed, 8 Jan 2020 18:14:24 +0100 Subject: [PATCH] REFACTOR: isValidLink - Reduced verbose comments - Merged 2 `if` which had the same logic --- .../javascripts/discourse/lib/click-track.js.es6 | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/click-track.js.es6 b/app/assets/javascripts/discourse/lib/click-track.js.es6 index c3186937b0..534c04a6c4 100644 --- a/app/assets/javascripts/discourse/lib/click-track.js.es6 +++ b/app/assets/javascripts/discourse/lib/click-track.js.es6 @@ -8,21 +8,13 @@ import ENV from "discourse-common/config/environment"; import User from "discourse/models/user"; export function isValidLink($link) { - // Do not track: - // - lightboxes - // - links with disabled tracking - // - category links - // - quote back button + // .hashtag == category/tag link + // .back == quote back ^ button if ($link.is(".lightbox, .no-track-link, .hashtag, .back")) { return false; } - // Do not track links in quotes or in elided part - if ($link.parents("aside.quote, .elided").length !== 0) { - return false; - } - - if ($link.parents(".expanded-embed").length !== 0) { + if ($link.parents("aside.quote, .elided, .expanded-embed").length !== 0) { return false; }