diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-09-21 09:46:47 +0200 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-09-21 10:35:37 +0200 |
commit | ee028d9d60522f8993a0b2429ac8a0631d59229a (patch) | |
tree | 5e028593ff4394df287de8f61824c8d004a81688 /lib/gitlab | |
parent | 11bbc06b4bbcb678f3ee6b8f1d143ed86d25a76c (diff) | |
download | gitlab-ce-ee028d9d60522f8993a0b2429ac8a0631d59229a.tar.gz |
Rename reply_by_email to incoming_email to prepare for the future.
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/email/receiver.rb | 5 | ||||
-rw-r--r-- | lib/gitlab/incoming_email.rb (renamed from lib/gitlab/reply_by_email.rb) | 20 |
2 files changed, 10 insertions, 15 deletions
diff --git a/lib/gitlab/email/receiver.rb b/lib/gitlab/email/receiver.rb index 355fbd27898..2b252b32887 100644 --- a/lib/gitlab/email/receiver.rb +++ b/lib/gitlab/email/receiver.rb @@ -65,7 +65,7 @@ module Gitlab def reply_key reply_key = nil message.to.each do |address| - reply_key = Gitlab::ReplyByEmail.reply_key_from_address(address) + reply_key = Gitlab::IncomingEmail.key_from_address(address) break if reply_key end @@ -98,7 +98,8 @@ module Gitlab note: reply, noteable_type: sent_notification.noteable_type, noteable_id: sent_notification.noteable_id, - commit_id: sent_notification.commit_id + commit_id: sent_notification.commit_id, + line_code: sent_notification.line_code ).execute end end diff --git a/lib/gitlab/reply_by_email.rb b/lib/gitlab/incoming_email.rb index c3fe6778f06..856ccc71084 100644 --- a/lib/gitlab/reply_by_email.rb +++ b/lib/gitlab/incoming_email.rb @@ -1,5 +1,5 @@ module Gitlab - module ReplyByEmail + module IncomingEmail class << self def enabled? config.enabled && address_formatted_correctly? @@ -7,20 +7,14 @@ module Gitlab def address_formatted_correctly? config.address && - config.address.include?("%{reply_key}") + config.address.include?("%{key}") end - def reply_key - return nil unless enabled? - - SecureRandom.hex(16) - end - - def reply_address(reply_key) - config.address.gsub('%{reply_key}', reply_key) + def reply_address(key) + config.address.gsub('%{key}', key) end - def reply_key_from_address(address) + def key_from_address(address) regex = address_regex return unless regex @@ -33,7 +27,7 @@ module Gitlab private def config - Gitlab.config.reply_by_email + Gitlab.config.incoming_email end def address_regex @@ -41,7 +35,7 @@ module Gitlab return nil unless wildcard_address regex = Regexp.escape(wildcard_address) - regex = regex.gsub(Regexp.escape('%{reply_key}'), "(.+)") + regex = regex.gsub(Regexp.escape('%{key}'), "(.+)") Regexp.new(regex).freeze end end |