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
Boxiang Sun
gitlab-ce
Commits
e6568d80
Commit
e6568d80
authored
Jun 05, 2018
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't update/create projects errors were added
This could be done when a block is passed in EE.
parent
96747556
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
app/services/projects/create_service.rb
app/services/projects/create_service.rb
+3
-0
app/services/projects/update_service.rb
app/services/projects/update_service.rb
+11
-4
No files found.
app/services/projects/create_service.rb
View file @
e6568d80
...
@@ -46,6 +46,9 @@ module Projects
...
@@ -46,6 +46,9 @@ module Projects
yield
(
@project
)
if
block_given?
yield
(
@project
)
if
block_given?
# If the block added errors, don't try to save the project
return
@project
if
@project
.
errors
.
any?
@project
.
creator
=
current_user
@project
.
creator
=
current_user
if
forked_from_project_id
if
forked_from_project_id
...
...
app/services/projects/update_service.rb
View file @
e6568d80
...
@@ -19,6 +19,9 @@ module Projects
...
@@ -19,6 +19,9 @@ module Projects
yield
if
block_given?
yield
if
block_given?
# If the block added errors, don't try to save the project
return
validation_failed!
if
project
.
errors
.
any?
if
project
.
update_attributes
(
params
.
except
(
:default_branch
))
if
project
.
update_attributes
(
params
.
except
(
:default_branch
))
if
project
.
previous_changes
.
include?
(
'path'
)
if
project
.
previous_changes
.
include?
(
'path'
)
project
.
rename_repo
project
.
rename_repo
...
@@ -30,10 +33,7 @@ module Projects
...
@@ -30,10 +33,7 @@ module Projects
success
success
else
else
model_errors
=
project
.
errors
.
full_messages
.
to_sentence
validation_failed!
error_message
=
model_errors
.
presence
||
'Project could not be updated!'
error
(
error_message
)
end
end
end
end
...
@@ -45,6 +45,13 @@ module Projects
...
@@ -45,6 +45,13 @@ module Projects
private
private
def
validation_failed!
model_errors
=
project
.
errors
.
full_messages
.
to_sentence
error_message
=
model_errors
.
presence
||
'Project could not be updated!'
error
(
error_message
)
end
def
renaming_project_with_container_registry_tags?
def
renaming_project_with_container_registry_tags?
new_path
=
params
[
:path
]
new_path
=
params
[
:path
]
...
...
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