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:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-07 15:06:18 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-07 15:06:18 +0300
commit185f428fa5e6123ffa0f29e307523da138e7b028 (patch)
tree1d5bb1d4700c0953aed2ad0e5d3515cc7935e550 /lib/gitlab/email
parentab2382923e7a864a3fa27fdf8eeb9b21893b9147 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/email')
-rw-r--r--lib/gitlab/email/receiver.rb21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/gitlab/email/receiver.rb b/lib/gitlab/email/receiver.rb
index 7da8b385266..847260b2e0f 100644
--- a/lib/gitlab/email/receiver.rb
+++ b/lib/gitlab/email/receiver.rb
@@ -32,7 +32,7 @@ module Gitlab
mail = build_mail
- ignore_auto_submitted!(mail)
+ ignore_auto_reply!(mail)
mail_key = extract_mail_key(mail)
handler = Handler.for(mail, mail_key)
@@ -96,14 +96,25 @@ module Gitlab
end
end
- def ignore_auto_submitted!(mail)
+ def ignore_auto_reply!(mail)
+ if auto_submitted?(mail) || auto_replied?(mail)
+ raise AutoGeneratedEmailError
+ end
+ end
+
+ def auto_submitted?(mail)
# Mail::Header#[] is case-insensitive
auto_submitted = mail.header['Auto-Submitted']&.value
# Mail::Field#value would strip leading and trailing whitespace
- raise AutoGeneratedEmailError if
- # See also https://tools.ietf.org/html/rfc3834
- auto_submitted && auto_submitted != 'no'
+ # See also https://tools.ietf.org/html/rfc3834
+ auto_submitted && auto_submitted != 'no'
+ end
+
+ def auto_replied?(mail)
+ autoreply = mail.header['X-Autoreply']&.value
+
+ autoreply && autoreply == 'yes'
end
end
end