A platform for community discussion. Free, open, simple.
FIX: wrong url for default logos in header on subfolder installs
Neil Lalonde8ceed642cb0c
diff --git a/app/assets/javascripts/discourse/widgets/home-logo.js.es6 b/app/assets/javascripts/discourse/widgets/home-logo.js.es6index 3bc8bca9caf..66231111ab2 100644--- a/app/assets/javascripts/discourse/widgets/home-logo.js.es6+++ b/app/assets/javascripts/discourse/widgets/home-logo.js.es6@@ -31,7 +31,7 @@ export default createWidget("home-logo", {if (logoSmallUrl.length) {return h("img#site-logo.logo-small", {key: "logo-small",- attributes: { src: logoSmallUrl, width: 33, height: 33, alt: title }+ attributes: { src: Discourse.getURL(logoSmallUrl), width: 33, height: 33, alt: title }});} else {return iconNode("home");@@ -39,12 +39,12 @@ export default createWidget("home-logo", {} else if (showMobileLogo) {return h("img#site-logo.logo-big", {key: "logo-mobile",- attributes: { src: mobileLogoUrl, alt: title }+ attributes: { src: Discourse.getURL(mobileLogoUrl), alt: title }});} else if (logoUrl.length) {return h("img#site-logo.logo-big", {key: "logo-big",- attributes: { src: logoUrl, alt: title }+ attributes: { src: Discourse.getURL(logoUrl), alt: title }});} else {return h("h1#site-text-logo.text-logo", { key: "logo-text" }, title);diff --git a/test/javascripts/widgets/home-logo-test.js.es6 b/test/javascripts/widgets/home-logo-test.js.es6index e64b9ac41e8..9911a3345ce 100644--- a/test/javascripts/widgets/home-logo-test.js.es6+++ b/test/javascripts/widgets/home-logo-test.js.es6@@ -96,3 +96,52 @@ widgetTest("mobile without logo", {assert.equal(this.$("#site-logo").attr("src"), bigLogo);}});++widgetTest("basics, subfolder", {+ template: '{{mount-widget widget="home-logo" args=args}}',+ beforeEach() {+ Discourse.BaseUri = "/forum";+ this.siteSettings.logo_url = bigLogo;+ this.siteSettings.logo_small_url = smallLogo;+ this.siteSettings.title = title;+ this.set("args", { minimized: false });+ },++ test(assert) {+ assert.ok(this.$("img#site-logo.logo-big").length === 1);+ assert.equal(this.$("#site-logo").attr("src"), `/forum${bigLogo}`);+ assert.equal(this.$("#site-logo").attr("alt"), title);+ }+});++widgetTest("basics, subfolder - minimized", {+ template: '{{mount-widget widget="home-logo" args=args}}',+ beforeEach() {+ Discourse.BaseUri = "/forum";+ this.siteSettings.logo_url = bigLogo;+ this.siteSettings.logo_small_url = smallLogo;+ this.siteSettings.title = title;+ this.set("args", { minimized: true });+ },++ test(assert) {+ assert.ok(this.$("img.logo-small").length === 1);+ assert.equal(this.$("img.logo-small").attr("src"), `/forum${smallLogo}`);+ assert.equal(this.$("img.logo-small").attr("alt"), title);+ }+});++widgetTest("mobile logo, subfolder", {+ template: '{{mount-widget widget="home-logo" args=args}}',+ beforeEach() {+ Discourse.BaseUri = "/forum";+ this.siteSettings.mobile_logo_url = mobileLogo;+ this.siteSettings.logo_small_url = smallLogo;+ this.site.mobileView = true;+ },++ test(assert) {+ assert.ok(this.$("img#site-logo.logo-big").length === 1);+ assert.equal(this.$("#site-logo").attr("src"), `/forum${mobileLogo}`);+ }+});