mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 11:17:42 +08:00
FIX: display conextual count on favicon if selected
This also corrects the test suite and moves the two notification counts so they are closer together.
This commit is contained in:
@ -51,12 +51,7 @@ const Discourse = Ember.Application.extend({
|
||||
$("title").text(title);
|
||||
}
|
||||
|
||||
var displayCount =
|
||||
Discourse.User.current() &&
|
||||
Discourse.User.currentProp("title_count_mode") === "notifications"
|
||||
? this.get("notificationCount")
|
||||
: this.get("contextCount");
|
||||
|
||||
var displayCount = this.get("displayCount");
|
||||
if (displayCount > 0 && !Discourse.User.currentProp("dynamic_favicon")) {
|
||||
title = `(${displayCount}) ${title}`;
|
||||
}
|
||||
@ -64,6 +59,14 @@ const Discourse = Ember.Application.extend({
|
||||
document.title = title;
|
||||
},
|
||||
|
||||
@computed("contextCount", "notificationCount")
|
||||
displayCount() {
|
||||
return Discourse.User.current() &&
|
||||
Discourse.User.currentProp("title_count_mode") === "notifications"
|
||||
? this.get("notificationCount")
|
||||
: this.get("contextCount");
|
||||
},
|
||||
|
||||
@observes("contextCount", "notificationCount")
|
||||
faviconChanged() {
|
||||
if (Discourse.User.currentProp("dynamic_favicon")) {
|
||||
@ -76,9 +79,7 @@ const Discourse = Ember.Application.extend({
|
||||
url = Discourse.getURL("/favicon/proxied?" + encodeURIComponent(url));
|
||||
}
|
||||
|
||||
var displayCount = Discourse.User.current()
|
||||
? this.get("notificationCount")
|
||||
: this.get("contextCount");
|
||||
var displayCount = this.get("displayCount");
|
||||
|
||||
new window.Favcount(url).set(displayCount);
|
||||
}
|
||||
|
Reference in New Issue
Block a user