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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d82005f2
Commit
d82005f2
authored
Jun 27, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Geo::DeletedProject#path_with_namespace
parent
7f605d07
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
9 deletions
+38
-9
app/models/geo/deleted_project.rb
app/models/geo/deleted_project.rb
+3
-3
app/services/ee/projects/destroy_service.rb
app/services/ee/projects/destroy_service.rb
+6
-0
app/services/projects/destroy_service.rb
app/services/projects/destroy_service.rb
+0
-6
spec/models/geo/deleted_project_spec.rb
spec/models/geo/deleted_project_spec.rb
+29
-0
No files found.
app/models/geo/deleted_project.rb
View file @
d82005f2
class
Geo::DeletedProject
<
::
Project
class
Geo::DeletedProject
<
::
Project
after_initialize
:readonly!
after_initialize
:readonly!
attr_reader
:full_path
def
initialize
(
id
:,
name
:,
full_path
:,
repository_storage
:)
def
initialize
(
id
:,
name
:,
full_path
:,
repository_storage
:)
repository_storage
||=
current_application_settings
.
pick_repository_storage
repository_storage
||=
current_application_settings
.
pick_repository_storage
...
@@ -9,7 +8,8 @@ class Geo::DeletedProject < ::Project
...
@@ -9,7 +8,8 @@ class Geo::DeletedProject < ::Project
@full_path
=
full_path
@full_path
=
full_path
end
end
def
repository
def
full_path
@
repository
||=
Repository
.
new
(
full_path
,
self
)
@
full_path
end
end
alias_method
:path_with_namespace
,
:full_path
end
end
app/services/ee/projects/destroy_service.rb
View file @
d82005f2
...
@@ -28,6 +28,12 @@ module EE
...
@@ -28,6 +28,12 @@ module EE
remove_tracking_entries!
remove_tracking_entries!
log_info
(
"Project
\"
#{
project
.
name
}
\"
was removed"
)
log_info
(
"Project
\"
#{
project
.
name
}
\"
was removed"
)
end
end
def
remove_tracking_entries!
return
unless
Gitlab
::
Geo
.
secondary?
Geo
::
ProjectRegistry
.
where
(
project_id:
project
.
id
).
delete_all
end
end
end
end
end
end
end
app/services/projects/destroy_service.rb
View file @
d82005f2
...
@@ -103,12 +103,6 @@ module Projects
...
@@ -103,12 +103,6 @@ module Projects
end
end
end
end
def
remove_tracking_entries!
return
unless
Gitlab
::
Geo
.
secondary?
Geo
::
ProjectRegistry
.
where
(
project_id:
project
.
id
).
delete_all
end
def
raise_error
(
message
)
def
raise_error
(
message
)
raise
DestroyError
.
new
(
message
)
raise
DestroyError
.
new
(
message
)
end
end
...
...
spec/models/geo/deleted_project_spec.rb
0 → 100644
View file @
d82005f2
require
'spec_helper'
RSpec
.
describe
Geo
::
DeletedProject
,
type: :model
do
subject
{
described_class
.
new
(
id:
1
,
name:
'sample'
,
full_path:
'root/sample'
,
repository_storage:
nil
)
}
it
{
expect
(
subject
).
to
be_kind_of
(
Project
)
}
describe
'#full_path'
do
it
'returns the initialized value'
do
expect
(
subject
.
full_path
).
to
eq
'root/sample'
end
end
describe
'#path_with_namespace'
do
it
'is an alias for full_path'
do
full_path
=
described_class
.
instance_method
(
:full_path
)
path_with_namespace
=
described_class
.
instance_method
(
:path_with_namespace
)
expect
(
path_with_namespace
).
to
eq
(
full_path
)
end
end
describe
'#repository'
do
it
'returns a valid repository'
do
expect
(
subject
.
repository
).
to
be_kind_of
(
Repository
)
expect
(
subject
.
repository
.
path_with_namespace
).
to
eq
(
'root/sample'
)
end
end
end
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