Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
863d8e5a
Commit
863d8e5a
authored
May 23, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use split and try to unify error raising
parent
c64cd113
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
12 deletions
+10
-12
lib/gitlab/email/handler/create_issue_handler.rb
lib/gitlab/email/handler/create_issue_handler.rb
+9
-9
lib/gitlab/email/handler/create_note_handler.rb
lib/gitlab/email/handler/create_note_handler.rb
+1
-1
lib/gitlab/email/receiver.rb
lib/gitlab/email/receiver.rb
+0
-2
No files found.
lib/gitlab/email/handler/create_issue_handler.rb
View file @
863d8e5a
...
@@ -5,8 +5,16 @@ module Gitlab
...
@@ -5,8 +5,16 @@ module Gitlab
module
Email
module
Email
module
Handler
module
Handler
class
CreateIssueHandler
<
BaseHandler
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?
def
can_handle?
!!
project
!!
(
project_namespace
&&
project
)
end
end
def
execute
def
execute
...
@@ -28,14 +36,6 @@ module Gitlab
...
@@ -28,14 +36,6 @@ module Gitlab
end
end
private
private
def
authentication_token
mail_key
[
/[^\+]+$/
]
end
def
project_namespace
mail_key
[
/^[^\+]+/
]
end
def
create_issue
def
create_issue
Issues
::
CreateService
.
new
(
Issues
::
CreateService
.
new
(
project
,
project
,
...
...
lib/gitlab/email/handler/create_note_handler.rb
View file @
863d8e5a
...
@@ -6,7 +6,7 @@ module Gitlab
...
@@ -6,7 +6,7 @@ module Gitlab
module
Handler
module
Handler
class
CreateNoteHandler
<
BaseHandler
class
CreateNoteHandler
<
BaseHandler
def
can_handle?
def
can_handle?
!!
sent_notification
!!
(
mail_key
&&
sent_notification
)
end
end
def
execute
def
execute
...
...
lib/gitlab/email/receiver.rb
View file @
863d8e5a
...
@@ -28,8 +28,6 @@ module Gitlab
...
@@ -28,8 +28,6 @@ module Gitlab
mail
=
build_mail
mail
=
build_mail
mail_key
=
extract_mail_key
(
mail
)
mail_key
=
extract_mail_key
(
mail
)
raise
SentNotificationNotFoundError
unless
mail_key
if
handler
=
Handler
.
for
(
mail
,
mail_key
)
if
handler
=
Handler
.
for
(
mail
,
mail_key
)
handler
.
execute
handler
.
execute
elsif
mail_key
=~
%r{/|
\+
}
elsif
mail_key
=~
%r{/|
\+
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment