Commit e75c9335 authored by Mark Chao's avatar Mark Chao

Merge branch 'memorycancel-master-patch-07264' into 'master'

Modify some email assets configurations to enable putting images outside assets

See merge request gitlab-org/gitlab!64270
parents 7227afe1 2421cb4f
......@@ -385,7 +385,15 @@ module Gitlab
initializer :correct_precompile_targets, after: :set_default_precompile do |app|
app.config.assets.precompile.reject! { |entry| entry == Sprockets::Railtie::LOOSE_APP_ASSETS }
asset_roots = [config.root.join("app/assets").to_s]
# if two files in assets are named the same, it'll likely resolve to the normal app/assets version.
# See https://gitlab.com/gitlab-jh/gitlab/-/merge_requests/27#note_609101582 for more details
asset_roots = []
if Gitlab.jh?
asset_roots << config.root.join("jh/app/assets").to_s
end
asset_roots << config.root.join("app/assets").to_s
if Gitlab.ee?
asset_roots << config.root.join("ee/app/assets").to_s
......@@ -413,16 +421,18 @@ module Gitlab
end
end
# Add EE assets. They should take precedence over CE. This means if two files exist, e.g.:
# Add assets for variants of GitLab. They should take precedence over CE.
# This means if multiple files exist, e.g.:
#
# jh/app/assets/stylesheets/example.scss
# ee/app/assets/stylesheets/example.scss
# app/assets/stylesheets/example.scss
#
# The ee/ version will be preferred.
initializer :prefer_ee_assets, after: :append_assets_path do |app|
if Gitlab.ee?
# The jh/ version will be preferred.
initializer :prefer_specialized_assets, after: :append_assets_path do |app|
Gitlab.extensions.each do |extension|
%w[images javascripts stylesheets].each do |path|
app.config.assets.paths.unshift("#{config.root}/ee/app/assets/#{path}")
app.config.assets.paths.unshift("#{config.root}/#{extension}/app/assets/#{path}")
end
end
end
......
......@@ -238,16 +238,16 @@ RSpec.describe EmailsHelper do
it 'returns the default header logo' do
create :appearance, header_logo: nil
expect(header_logo).to eq(
%{<img alt="GitLab" src="/images/mailers/gitlab_header_logo.gif" width="55" height="50" />}
expect(header_logo).to match(
%r{<img alt="GitLab" src="/images/mailers/gitlab_header_logo\.(?:gif|png)" width="\d+" height="\d+" />}
)
end
end
context 'there is no brand item' do
it 'returns the default header logo' do
expect(header_logo).to eq(
%{<img alt="GitLab" src="/images/mailers/gitlab_header_logo.gif" width="55" height="50" />}
expect(header_logo).to match(
%r{<img alt="GitLab" src="/images/mailers/gitlab_header_logo\.(?:gif|png)" width="\d+" height="\d+" />}
)
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment