Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
d138a949
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d138a949
编写于
7月 27, 2018
作者:
T
Tiago Botelho
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Backports EE-1499 to CE
上级
d9da5a98
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
42 addition
and
29 deletion
+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
未找到文件。
app/controllers/projects/mirrors_controller.rb
浏览文件 @
d138a949
...
...
@@ -13,7 +13,9 @@ class Projects::MirrorsController < Projects::ApplicationController
end
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.'
else
flash
[
:alert
]
=
project
.
errors
.
full_messages
.
join
(
', '
).
html_safe
...
...
lib/api/projects.rb
浏览文件 @
d138a949
...
...
@@ -13,6 +13,10 @@ module API
# EE::API::Projects would override this helper
end
params
:optional_update_params_ee
do
# EE::API::Projects would override this helper
end
# EE::API::Projects would override this method
def
apply_filters
(
projects
)
projects
=
projects
.
with_issues_available_for_user
(
current_user
)
if
params
[
:with_issues_enabled
]
...
...
@@ -21,6 +25,37 @@ module API
projects
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
helpers
do
...
...
@@ -252,39 +287,13 @@ module API
success
Entities
::
Project
end
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
:default_branch
,
type:
String
,
desc:
'The default branch of the project'
optional
:path
,
type:
String
,
desc:
'The path of the repository'
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
put
':id'
do
authorize_admin_project
...
...
@@ -294,6 +303,8 @@ module API
attrs
=
translate_params_for_compatibility
(
attrs
)
verify_update_project_attrs!
(
user_project
,
attrs
)
result
=
::
Projects
::
UpdateService
.
new
(
user_project
,
current_user
,
attrs
).
execute
if
result
[
:status
]
==
:success
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录