FIX: Only show link clicks on the title of a onebox, not repeatedly in

its body.
This commit is contained in:
Robin Ward 2014-04-17 13:01:44 -04:00
parent 87682f7539
commit ffc1634193
2 changed files with 2 additions and 2 deletions

View File

@ -41,7 +41,7 @@ Discourse.ClickTrack = {
// don't update counts in category badge
if ($link.closest('.badge-category').length === 0) {
// nor in oneboxes (except when we force it)
if ($link.closest(".onebox-result").length === 0 || $link.hasClass("track-link")) {
if (($link.closest(".onebox-result").length === 0 && $link.closest('.onebox-body').length === 0) || $link.hasClass("track-link")) {
var html = $badge.html();
if (/^\d+$/.test(html)) {
$badge.html(parseInt(html, 10) + 1);

View File

@ -139,7 +139,7 @@ Discourse.PostView = Discourse.GroupedView.extend(Ember.Evented, {
var link = $(this);
if (link.attr('href') === lc.url) {
// don't display badge counts on category badge
if (link.closest('.badge-category').length === 0 && (link.closest(".onebox-result").length === 0 || link.hasClass("track-link"))) {
if (link.closest('.badge-category').length === 0 && ((link.closest(".onebox-result").length === 0 && link.closest('.onebox-body').length === 0) || link.hasClass("track-link"))) {
link.append("<span class='badge badge-notification clicks' title='" +
I18n.t("topic_map.clicks", {count: lc.clicks}) +
"'>" + Discourse.Formatter.number(lc.clicks) + "</span>");