BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
468c8c5f
Commit
468c8c5f
authored
Feb 20, 2013
by
Andrew8xx8
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A little bit of codestyle improvments
parent
08f665cf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
system_hook_observer.rb
app/observers/system_hook_observer.rb
+9
-10
No files found.
app/observers/system_hook_observer.rb
View file @
468c8c5f
class
SystemHookObserver
<
ActiveRecord
::
Observer
observe
:user
,
:project
,
:users_project
def
after_create
(
model
)
if
model
.
kind_of?
Project
case
model
when
Project
SystemHook
.
all_hooks_fire
({
event_name:
"project_create"
,
name:
model
.
name
,
...
...
@@ -12,15 +13,14 @@ class SystemHookObserver < ActiveRecord::Observer
owner_email:
model
.
owner
.
email
,
created_at:
model
.
created_at
})
elsif
model
.
kind_of?
User
when
User
SystemHook
.
all_hooks_fire
({
event_name:
"user_create"
,
name:
model
.
name
,
email:
model
.
email
,
created_at:
model
.
created_at
})
elsif
model
.
kind_of?
UsersProject
when
UsersProject
SystemHook
.
all_hooks_fire
({
event_name:
"user_add_to_team"
,
project_name:
model
.
project
.
name
,
...
...
@@ -31,12 +31,12 @@ class SystemHookObserver < ActiveRecord::Observer
project_access:
model
.
repo_access_human
,
created_at:
model
.
created_at
})
end
end
def
after_destroy
(
model
)
if
model
.
kind_of?
Project
case
model
when
Project
SystemHook
.
all_hooks_fire
({
event_name:
"project_destroy"
,
name:
model
.
name
,
...
...
@@ -45,14 +45,13 @@ class SystemHookObserver < ActiveRecord::Observer
owner_name:
model
.
owner
.
name
,
owner_email:
model
.
owner
.
email
,
})
elsif
model
.
kind_of?
User
when
User
SystemHook
.
all_hooks_fire
({
event_name:
"user_destroy"
,
name:
model
.
name
,
email:
model
.
email
})
elsif
model
.
kind_of?
UsersProject
when
UsersProject
SystemHook
.
all_hooks_fire
({
event_name:
"user_remove_from_team"
,
project_name:
model
.
project
.
name
,
...
...
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