summaryrefslogtreecommitdiff
path: root/app/helpers/groups_helper.rb
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2018-02-23 12:10:57 +0000
committerSean McGivern <sean@gitlab.com>2018-02-27 10:32:29 +0000
commit868cb4307f93b2f8fa0d25d9e47e632d0855881e (patch)
treec611b02f7bf745fadbd7eef47486aa9331fceaed /app/helpers/groups_helper.rb
parent58a312f5097b30a93100de93d06427402d514b48 (diff)
downloadgitlab-ce-868cb4307f93b2f8fa0d25d9e47e632d0855881e.tar.gz
Fix subgroup issue and MR pages empty states and counts43510-merge-requests-and-issues-don-t-show-for-all-subgroups
Previously, these wouldn't count issues or MRs in subgroups - meaning that if _this_ group had no issues or MRs, we'd show the empty state, which was wrong.
Diffstat (limited to 'app/helpers/groups_helper.rb')
-rw-r--r--app/helpers/groups_helper.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb
index 5fbaa17c40e..7910de73c52 100644
--- a/app/helpers/groups_helper.rb
+++ b/app/helpers/groups_helper.rb
@@ -19,6 +19,20 @@ module GroupsHelper
can?(current_user, :change_share_with_group_lock, group)
end
+ def group_issues_count(state:)
+ IssuesFinder
+ .new(current_user, group_id: @group.id, state: state, non_archived: true, include_subgroups: true)
+ .execute
+ .count
+ end
+
+ def group_merge_requests_count(state:)
+ MergeRequestsFinder
+ .new(current_user, group_id: @group.id, state: state, non_archived: true, include_subgroups: true)
+ .execute
+ .count
+ end
+
def group_icon(group, options = {})
img_path = group_icon_url(group, options)
image_tag img_path, options
@@ -77,10 +91,6 @@ module GroupsHelper
end
end
- def group_issues(group)
- IssuesFinder.new(current_user, group_id: group.id).execute
- end
-
def remove_group_message(group)
_("You are going to remove %{group_name}. Removed groups CANNOT be restored! Are you ABSOLUTELY sure?") %
{ group_name: group.name }