summaryrefslogtreecommitdiff
path: root/lib/gitlab/issuables_count_for_state.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 18:42:06 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 18:42:06 +0000
commit6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch)
tree78be5963ec075d80116a932011d695dd33910b4e /lib/gitlab/issuables_count_for_state.rb
parent1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff)
downloadgitlab-ce-6e4e1050d9dba2b7b2523fdd1768823ab85feef4.tar.gz
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'lib/gitlab/issuables_count_for_state.rb')
-rw-r--r--lib/gitlab/issuables_count_for_state.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/gitlab/issuables_count_for_state.rb b/lib/gitlab/issuables_count_for_state.rb
index 659fb1472d2..7be54a214dd 100644
--- a/lib/gitlab/issuables_count_for_state.rb
+++ b/lib/gitlab/issuables_count_for_state.rb
@@ -9,9 +9,16 @@ module Gitlab
# The state values that can be safely casted to a Symbol.
STATES = %w[opened closed merged all].freeze
+ attr_reader :project
+
+ def self.declarative_policy_class
+ 'IssuablePolicy'
+ end
+
# finder - The finder class to use for retrieving the issuables.
- def initialize(finder)
+ def initialize(finder, project = nil)
@finder = finder
+ @project = project
@cache = Gitlab::SafeRequestStore[CACHE_KEY] ||= initialize_cache
end
@@ -19,6 +26,11 @@ module Gitlab
self[state || :opened]
end
+ # Define method for each state
+ STATES.each do |state|
+ define_method(state) { self[state] }
+ end
+
# Returns the count for the given state.
#
# state - The name of the state as either a String or a Symbol.