2012-03-04 14:35:15 +01:00
|
|
|
class ProjectObserver < ActiveRecord::Observer
|
2012-11-21 06:54:05 +01:00
|
|
|
def after_create(project)
|
2012-03-04 14:35:15 +01:00
|
|
|
project.update_repository
|
|
|
|
end
|
|
|
|
|
2012-12-20 21:16:51 +01:00
|
|
|
def after_update(project)
|
|
|
|
project.send_move_instructions if project.namespace_id_changed?
|
2012-11-21 06:54:05 +01:00
|
|
|
end
|
|
|
|
|
2012-03-04 14:35:15 +01:00
|
|
|
def after_destroy(project)
|
2012-09-11 22:24:53 +02:00
|
|
|
log_info("Project \"#{project.name}\" was removed")
|
|
|
|
|
2013-01-28 16:22:45 +01:00
|
|
|
project.satellite.destroy
|
2012-03-04 14:35:15 +01:00
|
|
|
project.destroy_repository
|
|
|
|
end
|
2012-09-11 22:24:53 +02:00
|
|
|
|
|
|
|
def after_create project
|
2013-01-28 22:03:38 +01:00
|
|
|
log_info("#{project.owner.name} created a new project \"#{project.name_with_namespace}\"")
|
2012-09-11 22:24:53 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def log_info message
|
|
|
|
Gitlab::AppLogger.info message
|
|
|
|
end
|
2012-03-04 14:35:15 +01:00
|
|
|
end
|