diff options
author | Heinrich Lee Yu <hleeyu@gmail.com> | 2018-12-31 11:23:50 +0800 |
---|---|---|
committer | Heinrich Lee Yu <hleeyu@gmail.com> | 2019-01-07 11:16:58 +0800 |
commit | 63e9969ca3ac57839b78d9cc44bcf32bc9a45248 (patch) | |
tree | cda51e40b5ea915d26425edfce815ca6fae991e9 /app/services/upload_service.rb | |
parent | ccbc45559b7bedd1d76c1840bbdfba3cce542af7 (diff) | |
download | gitlab-ce-63e9969ca3ac57839b78d9cc44bcf32bc9a45248.tar.gz |
Refactor upload service to return uploader
Also changes old calls to the service
Diffstat (limited to 'app/services/upload_service.rb')
-rw-r--r-- | app/services/upload_service.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/app/services/upload_service.rb b/app/services/upload_service.rb index 47903eb48c3..41ca95b3b6f 100644 --- a/app/services/upload_service.rb +++ b/app/services/upload_service.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true class UploadService - attr_accessor :uploader - def initialize(model, file, uploader_class = FileUploader, **uploader_context) @model, @file, @uploader_class, @uploader_context = model, file, uploader_class, uploader_context end @@ -10,10 +8,10 @@ class UploadService def execute return nil unless @file && @file.size <= max_attachment_size - @uploader = @uploader_class.new(@model, nil, @uploader_context) - @uploader.store!(@file) + uploader = @uploader_class.new(@model, nil, @uploader_context) + uploader.store!(@file) - @uploader.to_h + uploader end private |