diff options
author | blackst0ne <blackst0ne.ru@gmail.com> | 2017-05-10 15:26:17 +1100 |
---|---|---|
committer | blackst0ne <blackst0ne.ru@gmail.com> | 2017-05-10 15:26:17 +1100 |
commit | 29a3203b3fe08649b80def65b7750a866454d3d6 (patch) | |
tree | d4e644c142b1ecc6dd869c636ad5657c546d901b /app/models/project.rb | |
parent | ecc6cc8be75b5c66fdf7f5595b71aabf9366a5e1 (diff) | |
download | gitlab-ce-29a3203b3fe08649b80def65b7750a866454d3d6.tar.gz |
Use relative paths for group/project/user avatars
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index a0413b4e651..1f550cc02e2 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -6,6 +6,7 @@ class Project < ActiveRecord::Base include Gitlab::VisibilityLevel include Gitlab::CurrentSettings include AccessRequestable + include Avatarable include CacheMarkdownField include Referable include Sortable @@ -798,12 +799,10 @@ class Project < ActiveRecord::Base repository.avatar end - def avatar_url - if self[:avatar].present? - [gitlab_config.url, avatar.url].join - elsif avatar_in_git - Gitlab::Routing.url_helpers.namespace_project_avatar_url(namespace, self) - end + def avatar_url(**args) + # We use avatar_path instead of overriding avatar_url because of carrierwave. + # See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11001/diffs#note_28659864 + avatar_path(args) || (Gitlab::Routing.url_helpers.namespace_project_avatar_url(namespace, self) if avatar_in_git) end # For compatibility with old code |