mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 03:40:00 +08:00
FIX: Show title as home logo if title has been set and logo is blank.
https://meta.discourse.org/t/default-text-logo-not-working/103936
This commit is contained in:
parent
99856478d6
commit
2956c52e57
|
@ -17,7 +17,7 @@ export default createWidget("home-logo", {
|
|||
},
|
||||
|
||||
logoUrl() {
|
||||
return this.siteSettings.site_logo_url || "";
|
||||
return this.siteSettings.site_home_logo_url || "";
|
||||
},
|
||||
|
||||
mobileLogoUrl() {
|
||||
|
|
|
@ -175,8 +175,19 @@ class SiteSetting < ActiveRecord::Base
|
|||
site_logo_small_url
|
||||
site_mobile_logo_url
|
||||
site_favicon_url
|
||||
site_home_logo_url
|
||||
}.each { |client_setting| client_settings << client_setting }
|
||||
|
||||
def self.site_home_logo_url
|
||||
upload = SiteSetting.logo
|
||||
|
||||
if SiteSetting.defaults.get(:title) != SiteSetting.title && !upload
|
||||
''
|
||||
else
|
||||
full_cdn_url(upload ? upload.url : '/images/d-logo-sketch.png')
|
||||
end
|
||||
end
|
||||
|
||||
def self.site_logo_url
|
||||
upload = self.logo
|
||||
upload ? full_cdn_url(upload.url) : self.logo_url(warn: false)
|
||||
|
|
|
@ -150,6 +150,40 @@ describe SiteSetting do
|
|||
end
|
||||
end
|
||||
|
||||
describe '.site_home_logo_url' do
|
||||
describe 'when logo site setting is set' do
|
||||
let(:upload) { Fabricate(:upload) }
|
||||
|
||||
before do
|
||||
SiteSetting.logo = upload
|
||||
end
|
||||
|
||||
it 'should return the right URL' do
|
||||
expect(SiteSetting.site_home_logo_url)
|
||||
.to eq("#{Discourse.base_url}#{upload.url}")
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when logo site setting is not set' do
|
||||
describe 'when there is a custom title' do
|
||||
before do
|
||||
SiteSetting.title = "test"
|
||||
end
|
||||
|
||||
it 'should return a blank string' do
|
||||
expect(SiteSetting.site_home_logo_url).to eq('')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when title has not been set' do
|
||||
it 'should return the default logo url' do
|
||||
expect(SiteSetting.site_home_logo_url)
|
||||
.to eq("#{Discourse.base_url}/images/d-logo-sketch.png")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'deprecated site settings' do
|
||||
before do
|
||||
SiteSetting.force_https = true
|
||||
|
|
Loading…
Reference in New Issue
Block a user