Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
a7d5052c
Commit
a7d5052c
authored
Jun 17, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove SystemHook observer
parent
6149dba5
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
16 additions
and
20 deletions
+16
-20
app/observers/base_observer.rb
app/observers/base_observer.rb
+4
-0
app/observers/system_hook_observer.rb
app/observers/system_hook_observer.rb
+0
-17
app/observers/user_observer.rb
app/observers/user_observer.rb
+2
-1
app/observers/users_project_observer.rb
app/observers/users_project_observer.rb
+2
-0
app/services/base_service.rb
app/services/base_service.rb
+4
-0
app/services/projects/create_service.rb
app/services/projects/create_service.rb
+1
-0
app/services/projects/destroy_service.rb
app/services/projects/destroy_service.rb
+2
-0
config/application.rb
config/application.rb
+1
-2
No files found.
app/observers/base_observer.rb
View file @
a7d5052c
...
...
@@ -10,4 +10,8 @@ class BaseObserver < ActiveRecord::Observer
def
log_info
message
Gitlab
::
AppLogger
.
info
message
end
def
system_hook_service
SystemHooksService
.
new
end
end
app/observers/system_hook_observer.rb
deleted
100644 → 0
View file @
6149dba5
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
app/observers/user_observer.rb
View file @
a7d5052c
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
...
...
app/observers/users_project_observer.rb
View file @
a7d5052c
...
...
@@ -7,6 +7,7 @@ class UsersProjectObserver < BaseObserver
)
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 @@ class UsersProjectObserver < BaseObserver
action:
Event
::
LEFT
,
author_id:
users_project
.
user
.
id
)
system_hook_service
.
execute_hooks_for
(
users_project
,
:destroy
)
end
end
app/services/base_service.rb
View file @
a7d5052c
...
...
@@ -28,4 +28,8 @@ class BaseService
def
log_info
message
Gitlab
::
AppLogger
.
info
message
end
def
system_hook_service
SystemHooksService
.
new
end
end
app/services/projects/create_service.rb
View file @
a7d5052c
...
...
@@ -52,6 +52,7 @@ module Projects
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
(
...
...
app/services/projects/destroy_service.rb
View file @
a7d5052c
...
...
@@ -19,6 +19,8 @@ module Projects
project
.
satellite
.
destroy
log_info
(
"Project
\"
#{
project
.
name
}
\"
was removed"
)
system_hook_service
.
execute_hooks_for
(
project
,
:destroy
)
true
end
end
end
...
...
config/application.rb
View file @
a7d5052c
...
...
@@ -19,8 +19,7 @@ module Gitlab
# 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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment