This instance will be upgraded to Heptapod 0.31.0 (final) on 2022-05-24 at 14:00 UTC+2 (a few minutes of down time)

Commit a7d5052c authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Remove SystemHook observer

parent 38fafce1af55
......@@ -10,4 +10,8 @@ def event_service
def log_info message
Gitlab::AppLogger.info message
end
def system_hook_service
SystemHooksService.new
end
end
class SystemHookObserver < BaseObserver
observe :user, :project, :users_project
def after_create(model)
system_hook_service.execute_hooks_for(model, :create)
end
def after_destroy(model)
system_hook_service.execute_hooks_for(model, :destroy)
end
private
def system_hook_service
SystemHooksService.new
end
end
class UserObserver < BaseObserver
def after_create(user)
log_info("User \"#{user.name}\" (#{user.email}) was created")
notification.new_user(user)
system_hook_service.execute_hooks_for(user, :create)
end
def after_destroy user
log_info("User \"#{user.name}\" (#{user.email}) was removed")
system_hook_service.execute_hooks_for(user, :destroy)
end
def after_save user
......
......@@ -7,6 +7,7 @@ def after_create(users_project)
)
notification.new_team_member(users_project)
system_hook_service.execute_hooks_for(users_project, :create)
end
def after_update(users_project)
......@@ -19,5 +20,6 @@ def after_destroy(users_project)
action: Event::LEFT,
author_id: users_project.user.id
)
system_hook_service.execute_hooks_for(users_project, :destroy)
end
end
......@@ -28,4 +28,8 @@ def event_service
def log_info message
Gitlab::AppLogger.info message
end
def system_hook_service
SystemHooksService.new
end
end
......@@ -52,6 +52,7 @@ def execute
if @project.save
log_info("#{@project.owner.name} created a new project \"#{@project.name_with_namespace}\"")
system_hook_service.execute_hooks_for(@project, :create)
unless @project.group
@project.users_projects.create(
......
......@@ -19,6 +19,8 @@ def execute(role = :default)
project.satellite.destroy
log_info("Project \"#{project.name}\" was removed")
system_hook_service.execute_hooks_for(project, :destroy)
true
end
end
end
......
......@@ -19,8 +19,7 @@ class Application < Rails::Application
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
config.active_record.observers = :system_hook_observer,
:user_observer,
config.active_record.observers = :user_observer,
:users_project_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment