Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2017-09-22 16:49:56 +0300
committerTim Zallmann <tzallmann@gitlab.com>2017-10-04 15:26:33 +0300
commit79c80de99d511d084cff072bd90192ffe8ba4cda (patch)
treee2bcf7d07fdefabb30b899e64f41ee766fcb771a /app/models/concerns/avatarable.rb
parent4a0f720a502ac02423cb9db20727ba386de3e1f1 (diff)
Making private project avatars use local paths + Some Group Icons
Diffstat (limited to 'app/models/concerns/avatarable.rb')
-rw-r--r--app/models/concerns/avatarable.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/app/models/concerns/avatarable.rb b/app/models/concerns/avatarable.rb
index 8fbfed11bdf..f8c0327e190 100644
--- a/app/models/concerns/avatarable.rb
+++ b/app/models/concerns/avatarable.rb
@@ -1,7 +1,7 @@
module Avatarable
extend ActiveSupport::Concern
- def avatar_path(only_path: true)
+ def avatar_path(only_path: true, use_asset_path: true)
return unless self[:avatar].present?
# If only_path is true then use the relative path of avatar.
@@ -9,10 +9,14 @@ module Avatarable
asset_host = ActionController::Base.asset_host
gitlab_host = only_path ? gitlab_config.relative_url_root : gitlab_config.url
- # If asset_host is set then it is expected that assets are handled by a standalone host.
- # That means we do not want to get GitLab's relative_url_root option anymore.
- host = asset_host.present? ? asset_host : gitlab_host
+ if use_asset_path
+ # If asset_host is set then it is expected that assets are handled by a standalone host.
+ # That means we do not want to get GitLab's relative_url_root option anymore.
+ host = asset_host.present? ? asset_host : gitlab_host
- [host, avatar.url].join
+ [host, avatar.url].join
+ else
+ avatar.url
+ end
end
end