diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-05-23 17:16:40 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-05-23 17:16:40 +0300 |
commit | 863d8e5ae55debc08bf095354aee0a63417624fc (patch) | |
tree | 5c7a8418efe8921c5d524dae9cec771b1da437a4 /lib/gitlab/email/handler/create_issue_handler.rb | |
parent | c64cd113ccd16fa210f9ea2808deb044aadc8f61 (diff) |
use split and try to unify error raising
Diffstat (limited to 'lib/gitlab/email/handler/create_issue_handler.rb')
-rw-r--r-- | lib/gitlab/email/handler/create_issue_handler.rb | 18 |
1 files changed, 9 insertions, 9 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, |