diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2019-01-15 15:53:30 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2019-01-15 15:53:30 +0300 |
commit | 7c58b3d2ed7a6eb855312a5eec7e3ff95ca2b670 (patch) | |
tree | 2efa79b23d647e4bef7422ec7fb99ae44eac57b1 /lib | |
parent | 64372c0f46b3b6bb17a41c9bf41579294050e49b (diff) | |
parent | bbf5e92300e9c86cd1d1866fa29266f6c2bc1114 (diff) |
Merge branch '11-7-stable' from GitLab.org
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/release/links.rb | 2 | ||||
-rw-r--r-- | lib/api/releases.rb | 1 | ||||
-rw-r--r-- | lib/gitlab/gon_helper.rb | 15 |
3 files changed, 11 insertions, 7 deletions
diff --git a/lib/api/release/links.rb b/lib/api/release/links.rb index a75a320e929..e3072684ef7 100644 --- a/lib/api/release/links.rb +++ b/lib/api/release/links.rb @@ -8,8 +8,6 @@ module API RELEASE_ENDPOINT_REQUIREMETS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS .merge(tag_name: API::NO_SLASH_URL_PART_REGEX) - before { error!('404 Not Found', 404) unless Feature.enabled?(:releases_page, user_project) } - params do requires :id, type: String, desc: 'The ID of a project' end diff --git a/lib/api/releases.rb b/lib/api/releases.rb index c3d4101528c..576fee51db0 100644 --- a/lib/api/releases.rb +++ b/lib/api/releases.rb @@ -7,7 +7,6 @@ module API RELEASE_ENDPOINT_REQUIREMETS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS .merge(tag_name: API::NO_SLASH_URL_PART_REGEX) - before { error!('404 Not Found', 404) unless Feature.enabled?(:releases_page, user_project) } before { authorize_read_releases! } params do diff --git a/lib/gitlab/gon_helper.rb b/lib/gitlab/gon_helper.rb index 15137140639..9b1794eec91 100644 --- a/lib/gitlab/gon_helper.rb +++ b/lib/gitlab/gon_helper.rb @@ -8,10 +8,7 @@ module Gitlab def add_gon_variables gon.api_version = 'v4' - gon.default_avatar_url = - Gitlab::Utils.append_path( - Gitlab.config.gitlab.url, - ActionController::Base.helpers.image_path('no_avatar.png')) + gon.default_avatar_url = default_avatar_url gon.max_file_size = Gitlab::CurrentSettings.max_attachment_size gon.asset_host = ActionController::Base.asset_host gon.webpack_public_path = webpack_public_path @@ -50,5 +47,15 @@ module Gitlab # use this method to push multiple feature flags. gon.push({ features: { var_name => enabled } }, true) end + + def default_avatar_url + # We can't use ActionController::Base.helpers.image_url because it + # doesn't return an actual URL because request is nil for some reason. + # + # We also can't use Gitlab::Utils.append_path because the image path + # may be an absolute URL. + URI.join(Gitlab.config.gitlab.url, + ActionController::Base.helpers.image_path('no_avatar.png')).to_s + end end end |