diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-08-19 03:02:26 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-08-19 03:02:26 +0300 |
commit | 8906cabae7a6be44cafcedcaf27352614fcc462b (patch) | |
tree | 6ff7220890a5d8e22d16af0daa9689eddd0d4767 /app | |
parent | a428838dc00dd95f5dad0e433ad2eb73df2eff0f (diff) |
Changes and stuff.
Diffstat (limited to 'app')
-rw-r--r-- | app/mailers/notify.rb | 10 | ||||
-rw-r--r-- | app/models/sent_notification.rb | 8 | ||||
-rw-r--r-- | app/workers/email_receiver_worker.rb | 2 |
3 files changed, 10 insertions, 10 deletions
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index 44df3d6407d..c2ea99d9688 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -146,7 +146,7 @@ class Notify < ActionMailer::Base if reply_key headers['X-GitLab-Reply-Key'] = reply_key - headers['Reply-To'] = Gitlab.config.reply_by_email.address.gsub('%{reply_key}', reply_key) + headers['Reply-To'] = Gitlab::ReplyByEmail.reply_address(reply_key) end mail(headers) @@ -165,6 +165,10 @@ class Notify < ActionMailer::Base headers['In-Reply-To'] = message_id(model) headers['References'] = message_id(model) + if headers[:subject] + headers[:subject].prepend('Re: ') + end + mail_new_thread(model, headers) end @@ -173,8 +177,6 @@ class Notify < ActionMailer::Base end def reply_key - return nil unless Gitlab.config.reply_by_email.enabled - - @reply_key ||= SecureRandom.hex(16) + @reply_key ||= Gitlab::ReplyByEmail.reply_key end end diff --git a/app/models/sent_notification.rb b/app/models/sent_notification.rb index a3d24669b52..23a1b19ea7c 100644 --- a/app/models/sent_notification.rb +++ b/app/models/sent_notification.rb @@ -6,8 +6,8 @@ class SentNotification < ActiveRecord::Base validate :project, :recipient, :reply_key, presence: true validate :reply_key, uniqueness: true - validates :noteable_id, presence: true, if: ->(n) { n.noteable_type.present? && n.noteable_type != 'Commit' } - validates :commit_id, presence: true, if: ->(n) { n.noteable_type == 'Commit' } + validates :noteable_id, presence: true, unless: :for_commit? + validates :commit_id, presence: true, if: :for_commit? def self.for(reply_key) find_by(reply_key: reply_key) @@ -19,11 +19,9 @@ class SentNotification < ActiveRecord::Base def noteable if for_commit? - project.commit(commit_id) + project.commit(commit_id) rescue nil else super end - rescue - nil end end diff --git a/app/workers/email_receiver_worker.rb b/app/workers/email_receiver_worker.rb index e44a430f6bc..94e346b5a51 100644 --- a/app/workers/email_receiver_worker.rb +++ b/app/workers/email_receiver_worker.rb @@ -4,7 +4,7 @@ class EmailReceiverWorker sidekiq_options queue: :incoming_email def perform(raw) - return unless Gitlab.config.reply_by_email.enabled + return unless Gitlab::ReplyByEmail.enabled? # begin Gitlab::EmailReceiver.new(raw).process |