From 6dbb2e4e94414906eac61c0b81de251b44238561 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 8 Sep 2016 16:03:32 +0800 Subject: [PATCH] =?UTF-8?q?Pull=20request=E6=95=B0=E9=87=8F=E4=B8=BA0?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E6=98=BE=E7=A4=BA=E5=9C=A8=E6=9B=B4?= =?UTF-8?q?=E5=A4=9A=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 8 +++++++- app/views/projects/_development_group.html.erb | 2 +- app/views/projects/_tools_expand.html.erb | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-) 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 %>