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:
authorRémy Coutable <remy@rymai.me>2016-03-10 19:15:14 +0300
committerRémy Coutable <remy@rymai.me>2016-03-15 13:23:57 +0300
commit76350e2ede187a8bd15e343c30537c90ee557aa7 (patch)
tree6b5081eda7f9c9c2e7b18e86ae1631dd3b5c7f2c /app/mailers/emails
parent9403142083bf0ace81fc3059f2d6c5a494e48cbf (diff)
Ensure "new SSH key" email do not ends up as dead Sidekiq jobs
Related to #2235. This is done by: 1. Delaying the notification sending after the SSH key is commited in DB 2. Gracefully exit the mailer method if the record cannot be found
Diffstat (limited to 'app/mailers/emails')
-rw-r--r--app/mailers/emails/profile.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/mailers/emails/profile.rb b/app/mailers/emails/profile.rb
index 3a83b083109..256cbcd73a1 100644
--- a/app/mailers/emails/profile.rb
+++ b/app/mailers/emails/profile.rb
@@ -14,7 +14,10 @@ module Emails
end
def new_ssh_key_email(key_id)
- @key = Key.find(key_id)
+ @key = Key.find_by_id(key_id)
+
+ return unless @key
+
@current_user = @user = @key.user
@target_url = user_url(@user)
mail(to: @user.notification_email, subject: subject("SSH key was added to your account"))