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
This commit is contained in:
commit
2dfddddd7b
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 '❤'
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue