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
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
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
32 deletions
+36
-32
app/observers/project_observer.rb
app/observers/project_observer.rb
+0
-30
app/services/projects/create_service.rb
app/services/projects/create_service.rb
+2
-0
app/services/projects/destroy_service.rb
app/services/projects/destroy_service.rb
+25
-0
app/services/projects/update_service.rb
app/services/projects/update_service.rb
+9
-1
config/application.rb
config/application.rb
+0
-1
No files found.
app/observers/project_observer.rb
deleted
100644 → 0
View file @
66e068bb
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
def
before_destroy
(
project
)
project
.
repository
.
expire_cache
unless
project
.
empty_repo?
end
def
after_destroy
(
project
)
GitlabShellWorker
.
perform_async
(
:remove_repository
,
project
.
path_with_namespace
)
GitlabShellWorker
.
perform_async
(
:remove_repository
,
project
.
path_with_namespace
+
".wiki"
)
project
.
satellite
.
destroy
log_info
(
"Project
\"
#{
project
.
name
}
\"
was removed"
)
end
end
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/services/projects/destroy_service.rb
0 → 100644
View file @
a7f3672b
module
Projects
class
UpdateService
<
BaseService
def
execute
(
role
=
:default
)
return
false
unless
can?
(
current_user
,
:remove_project
,
project
)
project
.
repository
.
expire_cache
unless
project
.
empty_repo?
if
project
.
destroy
GitlabShellWorker
.
perform_async
(
:remove_repository
,
project
.
path_with_namespace
)
GitlabShellWorker
.
perform_async
(
:remove_repository
,
project
.
path_with_namespace
+
".wiki"
)
project
.
satellite
.
destroy
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