FIX: Do not track user mentions.

This commit is contained in:
Bianca Nenciu 2019-04-23 23:07:02 +03:00
parent fca3f53e9c
commit b81d169e2a
4 changed files with 5 additions and 25 deletions

View File

@ -84,14 +84,6 @@ export default Ember.Component.extend(
"click.discourse-redirect",
".cooked a, a.track-link",
function(e) {
const $target = $(e.target);
if (
$target.hasClass("mention") ||
$target.parents(".expanded-embed").length
) {
return false;
}
return ClickTrack.trackClick(e);
}
);

View File

@ -5,14 +5,6 @@ export default Ember.Component.extend({
this._super(...arguments);
this.$().on("click.discourse-redirect", "#revisions a", function(e) {
const $target = $(e.target);
if (
$target.hasClass("mention") ||
$target.parents(".expanded-embed").length
) {
return false;
}
return ClickTrack.trackClick(e);
});
},

View File

@ -32,14 +32,6 @@ export default Ember.Component.extend(LoadMore, {
this.$().on("click.details-disabled", "details.disabled", () => false);
this.$().on("click.discourse-redirect", ".excerpt a", function(e) {
const $target = $(e.target);
if (
$target.hasClass("mention") ||
$target.parents(".expanded-embed").length
) {
return false;
}
return ClickTrack.trackClick(e);
});
}.on("didInsertElement"),

View File

@ -10,7 +10,7 @@ export function isValidLink($link) {
// - links with disabled tracking
// - category links
// - quote back button
if ($link.is(".lightbox, .mention-group, .no-track-link, .hashtag, .back")) {
if ($link.is(".lightbox, .mention, .mention-group, .no-track-link, .hashtag, .back")) {
return false;
}
@ -19,6 +19,10 @@ export function isValidLink($link) {
return false;
}
if ($link.parents(".expanded-embed").length !== 0) {
return false;
}
return (
$link.hasClass("track-link") ||
$link.closest(".hashtag, .badge-category, .onebox-result, .onebox-body")