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:
authorLin Jen-Shin <godfat@godfat.org>2016-05-23 17:16:40 +0300
committerLin Jen-Shin <godfat@godfat.org>2016-05-23 17:16:40 +0300
commit863d8e5ae55debc08bf095354aee0a63417624fc (patch)
tree5c7a8418efe8921c5d524dae9cec771b1da437a4 /lib/gitlab/email/handler
parentc64cd113ccd16fa210f9ea2808deb044aadc8f61 (diff)
use split and try to unify error raising
Diffstat (limited to 'lib/gitlab/email/handler')
-rw-r--r--lib/gitlab/email/handler/create_issue_handler.rb18
-rw-r--r--lib/gitlab/email/handler/create_note_handler.rb2
2 files changed, 10 insertions, 10 deletions
diff --git a/lib/gitlab/email/handler/create_issue_handler.rb b/lib/gitlab/email/handler/create_issue_handler.rb
index cba8f2b61f6..7e3506bbd3f 100644
--- a/lib/gitlab/email/handler/create_issue_handler.rb
+++ b/lib/gitlab/email/handler/create_issue_handler.rb
@@ -5,8 +5,16 @@ module Gitlab
module Email
module Handler
class CreateIssueHandler < BaseHandler
+ attr_reader :project_namespace, :authentication_token
+
+ def initialize(mail, mail_key)
+ super(mail, mail_key)
+ @project_namespace, @authentication_token =
+ mail_key && mail_key.split('+', 2)
+ end
+
def can_handle?
- !!project
+ !!(project_namespace && project)
end
def execute
@@ -28,14 +36,6 @@ module Gitlab
end
private
- def authentication_token
- mail_key[/[^\+]+$/]
- end
-
- def project_namespace
- mail_key[/^[^\+]+/]
- end
-
def create_issue
Issues::CreateService.new(
project,
diff --git a/lib/gitlab/email/handler/create_note_handler.rb b/lib/gitlab/email/handler/create_note_handler.rb
index 282f1844097..b91dd623161 100644
--- a/lib/gitlab/email/handler/create_note_handler.rb
+++ b/lib/gitlab/email/handler/create_note_handler.rb
@@ -6,7 +6,7 @@ module Gitlab
module Handler
class CreateNoteHandler < BaseHandler
def can_handle?
- !!sent_notification
+ !!(mail_key && sent_notification)
end
def execute