gitlabhq/app/observers/key_observer.rb

23 lines
414 B
Ruby
Raw Normal View History

class KeyObserver < ActiveRecord::Observer
2013-01-03 09:06:07 +02:00
include Gitolited
def after_save(key)
2013-01-28 21:02:10 +02:00
GitoliteWorker.perform_async(
:set_key,
key.identifier,
key.key,
key.projects.map(&:id)
)
end
def after_destroy(key)
return if key.is_deploy_key && !key.last_deploy?
2013-01-28 21:02:10 +02:00
GitoliteWorker.perform_async(
:remove_key,
key.identifier,
key.projects.map(&:id)
)
end
end