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
Léo-Paul Géneau
gitlab-ce
Commits
d138a949
Commit
d138a949
authored
Jul 27, 2018
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backports EE-1499 to CE
parent
d9da5a98
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
29 deletions
+42
-29
app/controllers/projects/mirrors_controller.rb
app/controllers/projects/mirrors_controller.rb
+3
-1
lib/api/projects.rb
lib/api/projects.rb
+39
-28
No files found.
app/controllers/projects/mirrors_controller.rb
View file @
d138a949
...
@@ -13,7 +13,9 @@ class Projects::MirrorsController < Projects::ApplicationController
...
@@ -13,7 +13,9 @@ class Projects::MirrorsController < Projects::ApplicationController
end
end
def
update
def
update
if
project
.
update
(
mirror_params
)
result
=
::
Projects
::
UpdateService
.
new
(
project
,
current_user
,
mirror_params
).
execute
if
result
[
:status
]
==
:success
flash
[
:notice
]
=
'Mirroring settings were successfully updated.'
flash
[
:notice
]
=
'Mirroring settings were successfully updated.'
else
else
flash
[
:alert
]
=
project
.
errors
.
full_messages
.
join
(
', '
).
html_safe
flash
[
:alert
]
=
project
.
errors
.
full_messages
.
join
(
', '
).
html_safe
...
...
lib/api/projects.rb
View file @
d138a949
...
@@ -13,6 +13,10 @@ module API
...
@@ -13,6 +13,10 @@ module API
# EE::API::Projects would override this helper
# EE::API::Projects would override this helper
end
end
params
:optional_update_params_ee
do
# EE::API::Projects would override this helper
end
# EE::API::Projects would override this method
# EE::API::Projects would override this method
def
apply_filters
(
projects
)
def
apply_filters
(
projects
)
projects
=
projects
.
with_issues_available_for_user
(
current_user
)
if
params
[
:with_issues_enabled
]
projects
=
projects
.
with_issues_available_for_user
(
current_user
)
if
params
[
:with_issues_enabled
]
...
@@ -21,6 +25,37 @@ module API
...
@@ -21,6 +25,37 @@ module API
projects
projects
end
end
def
verify_update_project_attrs!
(
project
,
attrs
)
end
end
def
self
.
update_params_at_least_one_of
[
:jobs_enabled
,
:resolve_outdated_diff_discussions
,
:ci_config_path
,
:container_registry_enabled
,
:default_branch
,
:description
,
:issues_enabled
,
:lfs_enabled
,
:merge_requests_enabled
,
:merge_method
,
:name
,
:only_allow_merge_if_all_discussions_are_resolved
,
:only_allow_merge_if_pipeline_succeeds
,
:path
,
:printing_merge_request_link_enabled
,
:public_builds
,
:request_access_enabled
,
:shared_runners_enabled
,
:snippets_enabled
,
:tag_list
,
:visibility
,
:wiki_enabled
,
:avatar
]
end
end
helpers
do
helpers
do
...
@@ -252,39 +287,13 @@ module API
...
@@ -252,39 +287,13 @@ module API
success
Entities
::
Project
success
Entities
::
Project
end
end
params
do
params
do
# CE
at_least_one_of_ce
=
[
:jobs_enabled
,
:resolve_outdated_diff_discussions
,
:ci_config_path
,
:container_registry_enabled
,
:default_branch
,
:description
,
:issues_enabled
,
:lfs_enabled
,
:merge_requests_enabled
,
:merge_method
,
:name
,
:only_allow_merge_if_all_discussions_are_resolved
,
:only_allow_merge_if_pipeline_succeeds
,
:path
,
:printing_merge_request_link_enabled
,
:public_builds
,
:request_access_enabled
,
:shared_runners_enabled
,
:snippets_enabled
,
:tag_list
,
:visibility
,
:wiki_enabled
,
:avatar
]
optional
:name
,
type:
String
,
desc:
'The name of the project'
optional
:name
,
type:
String
,
desc:
'The name of the project'
optional
:default_branch
,
type:
String
,
desc:
'The default branch of the project'
optional
:default_branch
,
type:
String
,
desc:
'The default branch of the project'
optional
:path
,
type:
String
,
desc:
'The path of the repository'
optional
:path
,
type:
String
,
desc:
'The path of the repository'
use
:optional_project_params
use
:optional_project_params
at_least_one_of
(
*
at_least_one_of_ce
)
at_least_one_of
(
*::
API
::
Projects
.
update_params_at_least_one_of
)
end
end
put
':id'
do
put
':id'
do
authorize_admin_project
authorize_admin_project
...
@@ -294,6 +303,8 @@ module API
...
@@ -294,6 +303,8 @@ module API
attrs
=
translate_params_for_compatibility
(
attrs
)
attrs
=
translate_params_for_compatibility
(
attrs
)
verify_update_project_attrs!
(
user_project
,
attrs
)
result
=
::
Projects
::
UpdateService
.
new
(
user_project
,
current_user
,
attrs
).
execute
result
=
::
Projects
::
UpdateService
.
new
(
user_project
,
current_user
,
attrs
).
execute
if
result
[
:status
]
==
:success
if
result
[
:status
]
==
:success
...
...
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