Merge branch 'attachment_url_shouldnot_be_overwritten' into 'master'
Attachment url should not be overwritten Fixes #1786 See merge request !1308
This commit is contained in:
commit
bbf9953b99
|
@ -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
|
||||
|
|
|
@ -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!
|
||||
|
|
Loading…
Reference in New Issue