diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-06-29 12:51:09 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-06-29 12:51:09 +0300 |
commit | 2dfddddd7b9995439209831e36ab133a66d13cef (patch) | |
tree | 46ea485902bf8119465f97d8a4edb51b73aa0e10 | |
parent | f4d56b434b010527d214ffe5fa813c2d21342254 (diff) | |
parent | f83f1db4bde285ff8539e798a5b15383b06caff6 (diff) |
Merge branch 'dm-favicon-asset-host' into 'master'
Always serve favicon from main GitLab domain so that CI badge can be drawn over it
Closes #47802
See merge request gitlab-org/gitlab-ce!20263
-rw-r--r-- | changelogs/unreleased/dm-favicon-asset-host.yml | 6 | ||||
-rw-r--r-- | lib/banzai/pipeline/gfm_pipeline.rb | 6 | ||||
-rw-r--r-- | lib/gitlab/favicon.rb | 3 | ||||
-rw-r--r-- | spec/lib/banzai/filter/emoji_filter_spec.rb | 9 | ||||
-rw-r--r-- | spec/lib/gitlab/favicon_spec.rb | 2 |
5 files changed, 10 insertions, 16 deletions
diff --git a/changelogs/unreleased/dm-favicon-asset-host.yml b/changelogs/unreleased/dm-favicon-asset-host.yml new file mode 100644 index 00000000000..c2dc9d765e5 --- /dev/null +++ b/changelogs/unreleased/dm-favicon-asset-host.yml @@ -0,0 +1,6 @@ +--- +title: Always serve favicon from main GitLab domain so that CI badge can be drawn + over it +merge_request: +author: +type: fixed diff --git a/lib/banzai/pipeline/gfm_pipeline.rb b/lib/banzai/pipeline/gfm_pipeline.rb index a1f24e8b093..0d9b874ef85 100644 --- a/lib/banzai/pipeline/gfm_pipeline.rb +++ b/lib/banzai/pipeline/gfm_pipeline.rb @@ -44,11 +44,7 @@ module Banzai def self.transform_context(context) context[:only_path] = true unless context.key?(:only_path) - context.merge( - # EmojiFilter - asset_host: Gitlab::Application.config.asset_host, - asset_root: Gitlab.config.gitlab.base_url - ) + context end end end diff --git a/lib/gitlab/favicon.rb b/lib/gitlab/favicon.rb index d512fc58e46..4850a6c0430 100644 --- a/lib/gitlab/favicon.rb +++ b/lib/gitlab/favicon.rb @@ -38,7 +38,8 @@ module Gitlab # we only want to create full urls when there's a different asset_host # configured. def host - if Gitlab::Application.config.asset_host.nil? || Gitlab::Application.config.asset_host == Gitlab.config.gitlab.base_url + asset_host = ActionController::Base.asset_host + if asset_host.nil? || asset_host == Gitlab.config.gitlab.base_url nil else Gitlab.config.gitlab.base_url diff --git a/spec/lib/banzai/filter/emoji_filter_spec.rb b/spec/lib/banzai/filter/emoji_filter_spec.rb index 10910f22d4a..85a4619e33d 100644 --- a/spec/lib/banzai/filter/emoji_filter_spec.rb +++ b/spec/lib/banzai/filter/emoji_filter_spec.rb @@ -3,15 +3,6 @@ require 'spec_helper' describe Banzai::Filter::EmojiFilter do include FilterSpecHelper - before do - @original_asset_host = ActionController::Base.asset_host - ActionController::Base.asset_host = 'https://foo.com' - end - - after do - ActionController::Base.asset_host = @original_asset_host - end - it 'replaces supported name emoji' do doc = filter('<p>:heart:</p>') expect(doc.css('gl-emoji').first.text).to eq '❤' diff --git a/spec/lib/gitlab/favicon_spec.rb b/spec/lib/gitlab/favicon_spec.rb index 122dcd9634c..68abcb3520a 100644 --- a/spec/lib/gitlab/favicon_spec.rb +++ b/spec/lib/gitlab/favicon_spec.rb @@ -32,7 +32,7 @@ RSpec.describe Gitlab::Favicon, :request_store do end it 'returns a full url when the asset host is configured' do - allow(Gitlab::Application.config).to receive(:asset_host).and_return('http://assets.local') + allow(ActionController::Base).to receive(:asset_host).and_return('http://assets.local') expect(described_class.main).to match %r{^http://localhost/assets/favicon-(?:\h+).png$} end end |