gitlabhq/app/observers/key_observer.rb

23 lines
413 B
Ruby
Raw Normal View History

class KeyObserver < ActiveRecord::Observer
2013-01-03 08:06:07 +01:00
include Gitolited
def after_save(key)
2013-02-11 18:27:26 +01:00
GitlabShellWorker.perform_async(
2013-02-04 14:07:56 +01:00
:add_key,
key.shell_id,
2013-02-04 14:07:56 +01:00
key.key
2013-01-28 20:02:10 +01:00
)
# Notify about ssh key being added
Notify.delay.new_ssh_key_email(key.id) if key.user
end
def after_destroy(key)
2013-02-11 18:27:26 +01:00
GitlabShellWorker.perform_async(
2013-01-28 20:02:10 +01:00
:remove_key,
key.shell_id,
2013-02-04 14:07:56 +01:00
key.key,
2013-01-28 20:02:10 +01:00
)
end
end