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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-14 12:08:19 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-14 12:08:19 +0300
commit02ab65d49fc94be7c91e511899762236c122977d (patch)
tree4d4bf4ec54a95a0d73e039fa1410ea841156ffb2 /lib/gitlab/email
parent4411353300cf8219d2b899785bc5103c549ba8cf (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/email')
-rw-r--r--lib/gitlab/email/attachment_uploader.rb4
-rw-r--r--lib/gitlab/email/handler/reply_processing.rb9
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/gitlab/email/attachment_uploader.rb b/lib/gitlab/email/attachment_uploader.rb
index 3323ce60158..0a14a909e31 100644
--- a/lib/gitlab/email/attachment_uploader.rb
+++ b/lib/gitlab/email/attachment_uploader.rb
@@ -9,7 +9,7 @@ module Gitlab
@message = message
end
- def execute(project)
+ def execute(upload_parent:, uploader_class:)
attachments = []
message.attachments.each do |attachment|
@@ -23,7 +23,7 @@ module Gitlab
content_type: attachment.content_type
}
- uploader = UploadService.new(project, file).execute
+ uploader = UploadService.new(upload_parent, file, uploader_class).execute
attachments << uploader.to_h if uploader
ensure
tmp.close!
diff --git a/lib/gitlab/email/handler/reply_processing.rb b/lib/gitlab/email/handler/reply_processing.rb
index 6b7686cd405..312a9fdfbae 100644
--- a/lib/gitlab/email/handler/reply_processing.rb
+++ b/lib/gitlab/email/handler/reply_processing.rb
@@ -41,13 +41,20 @@ module Gitlab
end
def add_attachments(reply)
- attachments = Email::AttachmentUploader.new(mail).execute(project)
+ attachments = Email::AttachmentUploader.new(mail).execute(upload_params)
reply + attachments.map do |link|
"\n\n#{link[:markdown]}"
end.join
end
+ def upload_params
+ {
+ upload_parent: project,
+ uploader_class: FileUploader
+ }
+ end
+
def validate_permission!(permission)
raise UserNotFoundError unless author
raise UserBlockedError if author.blocked?