FEATURE: Allow logo URLs to be overridden easily using `reopenWidget()`

FEATURE: Allow logo URLs to be overridden easily using reopenWidget()

From 0083eec6869b3c849a7d6f8791e685753a02d150 Mon Sep 17 00:00:00 2001
From: David Taylor <david@taylorhq.com>
Date: Thu, 22 Nov 2018 16:29:12 +0000
Subject: [PATCH] FEATURE: Allow logo URLs to be overridden easily using
 `reopenWidget()`


diff --git a/app/assets/javascripts/discourse/widgets/home-logo.js.es6 b/app/assets/javascripts/discourse/widgets/home-logo.js.es6
index 5672cff..37bb69a 100644
--- a/app/assets/javascripts/discourse/widgets/home-logo.js.es6
+++ b/app/assets/javascripts/discourse/widgets/home-logo.js.es6
@@ -16,18 +16,30 @@ export default createWidget("home-logo", {
     return typeof href === "function" ? href() : href;
   },
 
+  logoUrl() {
+    return this.siteSettings.site_logo_url || "";
+  },
+
+  mobileLogoUrl() {
+    return this.siteSettings.site_mobile_logo_url || "";
+  },
+
+  smallLogoUrl() {
+    return this.siteSettings.site_logo_small_url || "";
+  },
+
   logo() {
     const { siteSettings } = this;
     const mobileView = this.site.mobileView;
 
-    const mobileLogoUrl = siteSettings.site_mobile_logo_url || "";
+    const mobileLogoUrl = this.mobileLogoUrl();
     const showMobileLogo = mobileView && mobileLogoUrl.length > 0;
 
-    const logoUrl = siteSettings.site_logo_url || "";
+    const logoUrl = this.logoUrl();
     const title = siteSettings.title;
 
     if (this.attrs.minimized) {
-      const logoSmallUrl = siteSettings.site_logo_small_url || "";
+      const logoSmallUrl = this.smallLogoUrl();
       if (logoSmallUrl.length) {
         return h("img#site-logo.logo-small", {
           key: "logo-small",

GitHub

1 Like

This commit has been mentioned on Discourse Meta. There might be relevant details there: