mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 20:22:45 +08:00
FIX: Only show link clicks on the title of a onebox, not repeatedly in
its body.
This commit is contained in:
parent
87682f7539
commit
ffc1634193
|
@ -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);
|
||||
|
|
|
@ -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>");
|
||||
|
|
Loading…
Reference in New Issue
Block a user