A platform for community discussion. Free, open, simple.
Fix favicon not updating on the client side when changed.
Guo Xiang Tanb9ab393d70a6
diff --git a/app/assets/javascripts/discourse.js.es6 b/app/assets/javascripts/discourse.js.es6index a393adbfc46..41eba5d39b9 100644--- a/app/assets/javascripts/discourse.js.es6+++ b/app/assets/javascripts/discourse.js.es6@@ -62,7 +62,15 @@ const Discourse = Ember.Application.extend({@observes("notifyCount")faviconChanged() {if (Discourse.User.currentProp("dynamic_favicon")) {- const url = Discourse.getURL("/favicon/proxied");+ let url = Discourse.SiteSettings.site_favicon_url;++ // Since the favicon is cached on the browser for a really long time, we+ // append the favicon_url as query params to the path so that the cache+ // is not used when the favicon changes.+ if (/^http/.test(url)) {+ url = Discourse.getURL("/favicon/proxied?" + encodeURIComponent(url));+ }+new window.Favcount(url).set(this.get("notifyCount"));}},diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rbindex 3ba48643559..95b4be02204 100644--- a/app/controllers/static_controller.rb+++ b/app/controllers/static_controller.rb@@ -124,7 +124,7 @@ class StaticController < ApplicationControlleris_asset_pathhijack do- data = DistributedMemoizer.memoize("FAVICON#{SiteSetting.favicon&.id}", 60 * 30) do+ data = DistributedMemoizer.memoize("FAVICON#{SiteSetting.site_favicon_url}", 60 * 30) dofavicon = SiteSetting.faviconnext "" unless favicon