mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
Fix favicon not updating on the client side when changed.
Regression from 1c6a2262b3b57d344a60402eee6b5cbcfab7cf6d. Documented the rational for include the url since we can't really test this properly.
This commit is contained in:
@ -62,7 +62,15 @@ const Discourse = Ember.Application.extend({
|
|||||||
@observes("notifyCount")
|
@observes("notifyCount")
|
||||||
faviconChanged() {
|
faviconChanged() {
|
||||||
if (Discourse.User.currentProp("dynamic_favicon")) {
|
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"));
|
new window.Favcount(url).set(this.get("notifyCount"));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -124,7 +124,7 @@ class StaticController < ApplicationController
|
|||||||
is_asset_path
|
is_asset_path
|
||||||
|
|
||||||
hijack do
|
hijack do
|
||||||
data = DistributedMemoizer.memoize("FAVICON#{SiteSetting.favicon&.id}", 60 * 30) do
|
data = DistributedMemoizer.memoize("FAVICON#{SiteSetting.site_favicon_url}", 60 * 30) do
|
||||||
favicon = SiteSetting.favicon
|
favicon = SiteSetting.favicon
|
||||||
next "" unless favicon
|
next "" unless favicon
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user