From db585009be76ed7b00b4298f863333c92b94cf04 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Fri, 5 Dec 2014 15:33:22 +0100 Subject: Revert "Merge pull request #7349 from srna/patch-1" This reverts commit b37b71d887e8521b8992aa6e4f789a38b393e55a, reversing changes made to 42a1d8083c77d3803320bbbd0ac1559ff32d2519. --- app/uploaders/attachment_uploader.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/uploaders/attachment_uploader.rb b/app/uploaders/attachment_uploader.rb index 29a55b36ca5..b122b6c8658 100644 --- a/app/uploaders/attachment_uploader.rb +++ b/app/uploaders/attachment_uploader.rb @@ -26,10 +26,6 @@ class AttachmentUploader < CarrierWave::Uploader::Base Gitlab.config.gitlab.relative_url_root + "/files/#{model.class.to_s.underscore}/#{model.id}/#{file.filename}" end - def url - Gitlab.config.gitlab.relative_url_root + super unless super.nil? - end - def file_storage? self.class.storage == CarrierWave::Storage::File end -- cgit v1.2.1 From 3f1fad5f090ba77f202ae9ad1adbad394deef4db Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Fri, 5 Dec 2014 15:59:55 +0100 Subject: Add an avatar_url spec when relative url is set. --- spec/helpers/application_helper_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 2db67cfdf95..07dd33b211b 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -66,6 +66,16 @@ describe ApplicationHelper do avatar_icon(user.email).to_s.should match("/uploads/user/avatar/#{ user.id }/gitlab_logo.png") end + it "should return an url for the avatar with relative url" do + Gitlab.config.gitlab.stub(relative_url_root: "/gitlab") + Gitlab.config.gitlab.stub(url: Settings.send(:build_gitlab_url)) + + user = create(:user) + user.avatar = File.open(avatar_file_path) + user.save! + avatar_icon(user.email).to_s.should match("/gitlab//uploads/user/avatar/#{ user.id }/gitlab_logo.png") + end + it "should call gravatar_icon when no avatar is present" do user = create(:user, email: 'test@example.com') user.save! -- cgit v1.2.1