diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3c125a185..b08b777df 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -832,7 +832,13 @@ module ApplicationHelper atts.count > 0 ? true :false end - # 必须是项目成,项目必须提交过代码 + # 如果Pull Request数量为0就显示在更多中 + def allow_show_pull_request project + g = Gitlab.client + count = g.merge_requests(project.gpid).count + end + + # 必须是项目成员,项目必须提交过代码 def allow_pull_request project return false if project.gpid.nil? g = Gitlab.client diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 17742f023..e6f3ad3da 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -41,7 +41,7 @@ <% end %> -<% if allow_pull_request(@project) %> +<% if allow_pull_request(@project) > 0 && allow_show_pull_request(@project) > 0 %>