FIX: track links in onebox body if it's same as header link.

FIX: track links in onebox body if it’s same as header link.

diff --git a/app/assets/javascripts/discourse/lib/click-track.js b/app/assets/javascripts/discourse/lib/click-track.js
index 534c04a..31bf961 100644
--- a/app/assets/javascripts/discourse/lib/click-track.js
+++ b/app/assets/javascripts/discourse/lib/click-track.js
@@ -18,6 +18,13 @@ export function isValidLink($link) {
     return false;
   }
 
+  if ($link.closest(".onebox-result, .onebox-body").length) {
+    const $a = $link.closest(".onebox").find("header a");
+    if ($a[0] && $a[0].href === $link[0].href) {
+      return true;
+    }
+  }
+
   return (
     $link.hasClass("track-link") ||
     $link.closest(".hashtag, .badge-category, .onebox-result, .onebox-body")

GitHub sha: e7e931b7