summaryrefslogtreecommitdiff
path: root/lib/gitlab/email/receiver.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-04-07 05:27:28 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-05-16 21:27:16 +0000
commit8156475ea501221c3ba1bf3280e8368b354839bc (patch)
treecd54d29751e40ab8423bf8cdf324a7548f73acf4 /lib/gitlab/email/receiver.rb
parent30b34437795eec6f55fb269cb6eff4a4f9da9cfc (diff)
downloadgitlab-ce-8156475ea501221c3ba1bf3280e8368b354839bc.tar.gz
Report better errors. TODO: Enable skipped test
Diffstat (limited to 'lib/gitlab/email/receiver.rb')
-rw-r--r--lib/gitlab/email/receiver.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/gitlab/email/receiver.rb b/lib/gitlab/email/receiver.rb
index 471d10a11a6..50c16da4ef6 100644
--- a/lib/gitlab/email/receiver.rb
+++ b/lib/gitlab/email/receiver.rb
@@ -5,6 +5,7 @@ module Gitlab
class ProcessingError < StandardError; end
class EmailUnparsableError < ProcessingError; end
class SentNotificationNotFoundError < ProcessingError; end
+ class ProjectNotFound < ProcessingError; end
class EmptyEmailError < ProcessingError; end
class AutoGeneratedEmailError < ProcessingError; end
class UserNotFoundError < ProcessingError; end
@@ -25,10 +26,16 @@ module Gitlab
process_create_note
elsif message_project
- process_create_issue
+ if message_sender.can?(:read_project, message_project)
+ process_create_issue
+ else # Must be private project without access
+ raise ProjectNotFound
+ end
+ elsif reply_key =~ %r{/|\+}
+ # Sent Notification reply_key would not have / or +
+ raise ProjectNotFound
else
- # TODO: could also be project not found
raise SentNotificationNotFoundError
end
end