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
a7f3672b
Commit
a7f3672b
authored
Jun 17, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove project observer
parent
66e068bb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
25 deletions
+29
-25
create_service.rb
app/services/projects/create_service.rb
+2
-0
destroy_service.rb
app/services/projects/destroy_service.rb
+18
-23
update_service.rb
app/services/projects/update_service.rb
+9
-1
application.rb
config/application.rb
+0
-1
No files found.
app/services/projects/create_service.rb
View file @
a7f3672b
...
...
@@ -51,6 +51,8 @@ module Projects
@project
.
creator
=
current_user
if
@project
.
save
log_info
(
"
#{
@project
.
owner
.
name
}
created a new project
\"
#{
@project
.
name_with_namespace
}
\"
"
)
unless
@project
.
group
@project
.
users_projects
.
create
(
project_access:
UsersProject
::
MASTER
,
...
...
app/
observers/project_observer
.rb
→
app/
services/projects/destroy_service
.rb
View file @
a7f3672b
class
ProjectObserver
<
BaseObserver
def
after_create
(
project
)
log_info
(
"
#{
project
.
owner
.
name
}
created a new project
\"
#{
project
.
name_with_namespace
}
\"
"
)
end
def
after_update
(
project
)
project
.
send_move_instructions
if
project
.
namespace_id_changed?
project
.
rename_repo
if
project
.
path_changed?
end
module
Projects
class
UpdateService
<
BaseService
def
execute
(
role
=
:default
)
return
false
unless
can?
(
current_user
,
:remove_project
,
project
)
def
before_destroy
(
project
)
project
.
repository
.
expire_cache
unless
project
.
empty_repo?
end
project
.
repository
.
expire_cache
unless
project
.
empty_repo?
def
after_destroy
(
project
)
GitlabShellWorker
.
perform_async
(
:remove_repository
,
project
.
path_with_namespace
)
if
project
.
destroy
GitlabShellWorker
.
perform_async
(
:remove_repository
,
project
.
path_with_namespace
)
GitlabShellWorker
.
perform_async
(
:remove_repository
,
project
.
path_with_namespace
+
".wiki"
)
GitlabShellWorker
.
perform_async
(
:remove_repository
,
project
.
path_with_namespace
+
".wiki"
)
project
.
satellite
.
destroy
project
.
satellite
.
destroy
log_info
(
"Project
\"
#{
project
.
name
}
\"
was removed"
)
log_info
(
"Project
\"
#{
project
.
name
}
\"
was removed"
)
end
end
end
end
app/services/projects/update_service.rb
View file @
a7f3672b
...
...
@@ -13,7 +13,15 @@ module Projects
project
.
change_head
(
new_branch
)
end
project
.
update_attributes
(
params
[
:project
],
as:
role
)
if
project
.
update_attributes
(
params
[
:project
],
as:
role
)
if
project
.
previous_changes
.
include?
(
'namespace_id'
)
project
.
send_move_instructions
end
if
project
.
previous_changes
.
include?
(
'path'
)
project
.
rename_repo
end
end
end
end
end
config/application.rb
View file @
a7f3672b
...
...
@@ -20,7 +20,6 @@ module Gitlab
# Activate observers that should always be running.
config
.
active_record
.
observers
=
:note_observer
,
:project_observer
,
:system_hook_observer
,
:user_observer
,
:users_project_observer
...
...
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