FIX: Favicon count was not updated when window focus returned (#10875)

FIX: Favicon count was not updated when window focus returned (#10875)

This misses a test because Favcount doesn’t exposes a get to the counter.

Also, since this code deals with all possible notifications configs we support:

  • favicon notification
  • favicon new content
  • title notification
  • title new content

the code is a bit complicated to follow. We may look into refactoring it when a good opportunity arises, like if Badging API setClientBadge() method gives us a cleaner way to notify users.

diff --git a/app/assets/javascripts/discourse/app/services/document-title.js b/app/assets/javascripts/discourse/app/services/document-title.js
index 709b5e3..944940c 100644
--- a/app/assets/javascripts/discourse/app/services/document-title.js
+++ b/app/assets/javascripts/discourse/app/services/document-title.js
@@ -44,6 +44,7 @@ export default Service.extend({
       this.notificationCount = 0;
     }
     this.appEvents.trigger("discourse:focus-changed", session.hasFocus);
+    this._renderFavicon();
     this._renderTitle();
   },
 

GitHub sha: 5157e3b6

This commit appears in #10875 which was approved by SamSaffron. It was merged by SamSaffron.