summaryrefslogtreecommitdiff
path: root/lib/gitlab/email/handler/create_note_handler.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/email/handler/create_note_handler.rb')
-rw-r--r--lib/gitlab/email/handler/create_note_handler.rb23
1 files changed, 7 insertions, 16 deletions
diff --git a/lib/gitlab/email/handler/create_note_handler.rb b/lib/gitlab/email/handler/create_note_handler.rb
index d87ba427f4b..31579e94a87 100644
--- a/lib/gitlab/email/handler/create_note_handler.rb
+++ b/lib/gitlab/email/handler/create_note_handler.rb
@@ -1,4 +1,3 @@
-
require 'gitlab/email/handler/base_handler'
require 'gitlab/email/handler/reply_processing'
@@ -8,6 +7,8 @@ module Gitlab
class CreateNoteHandler < BaseHandler
include ReplyProcessing
+ delegate :project, to: :sent_notification, allow_nil: true
+
def can_handle?
mail_key =~ /\A\w+\z/
end
@@ -27,32 +28,22 @@ module Gitlab
record_name: 'comment')
end
+ def metrics_params
+ super.merge(project: project&.full_path)
+ end
+
private
def author
sent_notification.recipient
end
- def project
- sent_notification.project
- end
-
def sent_notification
@sent_notification ||= SentNotification.for(mail_key)
end
def create_note
- Notes::CreateService.new(
- project,
- author,
- note: message,
- noteable_type: sent_notification.noteable_type,
- noteable_id: sent_notification.noteable_id,
- commit_id: sent_notification.commit_id,
- line_code: sent_notification.line_code,
- position: sent_notification.position,
- type: sent_notification.note_type
- ).execute
+ sent_notification.create_reply(message)
end
end
end