diff options
author | Alexis Reigel <mail@koffeinfrei.org> | 2017-02-28 12:49:59 +0300 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2017-07-27 16:40:41 +0300 |
commit | c1281982bd7975b45bed5b8e2c5ef5e242ea18fd (patch) | |
tree | a4a76d4cd9ab0d4ca324902355fa60ced1ecdb9b /app/models/gpg_key.rb | |
parent | f0fe1b9d4397e6c1c6aa2da6e371e234db774fe2 (diff) |
notification email on add new gpg key
Diffstat (limited to 'app/models/gpg_key.rb')
-rw-r--r-- | app/models/gpg_key.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/gpg_key.rb b/app/models/gpg_key.rb index 04c7ce2e79f..83a303ae953 100644 --- a/app/models/gpg_key.rb +++ b/app/models/gpg_key.rb @@ -1,4 +1,6 @@ class GpgKey < ActiveRecord::Base + include AfterCommitQueue + KEY_PREFIX = '-----BEGIN PGP PUBLIC KEY BLOCK-----'.freeze belongs_to :user @@ -20,6 +22,7 @@ class GpgKey < ActiveRecord::Base before_validation :extract_fingerprint after_create :add_to_keychain + after_create :notify_user after_destroy :remove_from_keychain def key=(value) @@ -62,4 +65,8 @@ class GpgKey < ActiveRecord::Base def remove_from_keychain Gitlab::Gpg::CurrentKeyChain.remove(fingerprint) end + + def notify_user + run_after_commit { NotificationService.new.new_gpg_key(self) } + end end |