diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-04-02 22:13:05 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-04-02 22:13:05 +0400 |
commit | 6ae2529041258c2d63a992298c9708cc03efd8d1 (patch) | |
tree | 5ca31855e3e15e2e8cb555c4f6b7058da798c0d7 /app/models | |
parent | 77c0a6db4baac1bd91e3636b32b3ffa9d0373211 (diff) |
Remove KeysObserver
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/key.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/models/key.rb b/app/models/key.rb index 29a76f53f3d..4202d79a956 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -29,6 +29,10 @@ class Key < ActiveRecord::Base delegate :name, :email, to: :user, prefix: true + after_create :add_to_shell + after_create :notify_user + after_destroy :remove_from_shell + def strip_white_space self.key = key.strip unless key.blank? end @@ -42,6 +46,26 @@ class Key < ActiveRecord::Base "key-#{id}" end + def add_to_shell + GitlabShellWorker.perform_async( + :add_key, + shell_id, + key + ) + end + + def notify_user + NotificationService.new.new_key(self) + end + + def remove_from_shell + GitlabShellWorker.perform_async( + :remove_key, + shell_id, + key, + ) + end + private def generate_fingerpint |