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>2017-02-03 12:16:21 +0300
committerLin Jen-Shin <godfat@godfat.org>2017-02-03 12:16:21 +0300
commit078689447313a2bd119b9376460272492b055796 (patch)
treee3cd48b7eae8786a5e217025e652a366d86dbdf5 /lib/gitlab/incoming_email.rb
parent15f8642994bc74bea1a39d079c70b1f4e4730bf1 (diff)
parentfd46fb1cd9cc1fdf826d31261aa594baa38d4898 (diff)
Merge remote-tracking branch 'upstream/master' into fix-references-header-parsing
* upstream/master: (574 commits) remove dateFormat global exception fix relative paths to xterm.js within fit.js use setFixtures instead of fixture.set prevent u2f tests from triggering a form submission while testing simplify test for focus state preload projects.json fixture preload projects.json fixture rework tests which rely on teaspoon-specific behavior Only render hr when user can't archive project. use setFixtures instead of fixture.set ensure helper classes and constants are exposed globally preload projects.json fixture fix fixture references in environments_spec allow console.xxx in tests, reorder eslint rules alphabetically remove redundant "data-toggle" attribute so Vue doesn't complain fix broken reference to formatDate in a CommonJS environment fix errors within gl_dropdown_spec.js when running in Karma fix intermittant errors in merge_commit_message_toggle_spec.rb Update installation docs to include Docker, others ignore node_modules in rubocop ...
Diffstat (limited to 'lib/gitlab/incoming_email.rb')
-rw-r--r--lib/gitlab/incoming_email.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/gitlab/incoming_email.rb b/lib/gitlab/incoming_email.rb
index 9ae3a2c1214..a386d9b36fb 100644
--- a/lib/gitlab/incoming_email.rb
+++ b/lib/gitlab/incoming_email.rb
@@ -1,5 +1,6 @@
module Gitlab
module IncomingEmail
+ UNSUBSCRIBE_SUFFIX = '+unsubscribe'.freeze
WILDCARD_PLACEHOLDER = '%{key}'.freeze
class << self
@@ -16,7 +17,11 @@ module Gitlab
end
def reply_address(key)
- config.address.gsub(WILDCARD_PLACEHOLDER, key)
+ config.address.sub(WILDCARD_PLACEHOLDER, key)
+ end
+
+ def unsubscribe_address(key)
+ config.address.sub(WILDCARD_PLACEHOLDER, "#{key}#{UNSUBSCRIBE_SUFFIX}")
end
def key_from_address(address)
@@ -48,7 +53,7 @@ module Gitlab
return nil unless wildcard_address
regex = Regexp.escape(wildcard_address)
- regex = regex.gsub(Regexp.escape('%{key}'), "(.+)")
+ regex = regex.sub(Regexp.escape(WILDCARD_PLACEHOLDER), '(.+)')
Regexp.new(regex).freeze
end
end