Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2019-02-13 22:31:14 +0300
committerFelipe Artur <felipefac@gmail.com>2019-02-13 22:31:14 +0300
commit26f40aefb09b96538fa99f74d46542ad39bb1679 (patch)
treed0019bab5871ba7ac76820ca70b26cbc57be60a6 /app/models/concerns/issuable.rb
parente2aa332504f6cd9eebaa30dfeb71edcea6f9495a (diff)
Code improvements
Diffstat (limited to 'app/models/concerns/issuable.rb')
-rw-r--r--app/models/concerns/issuable.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb
index 7bf553a0221..83bd8cc6478 100644
--- a/app/models/concerns/issuable.rb
+++ b/app/models/concerns/issuable.rb
@@ -132,6 +132,15 @@ module Issuable
fuzzy_search(query, [:title])
end
+ # Available state values persisted in state_id column using state machine
+ #
+ # Override this on subclasses if different states are needed
+ #
+ # Check MergeRequest.available_states for example
+ def available_states
+ @available_states ||= { opened: 1, closed: 2 }.with_indifferent_access
+ end
+
# Searches for records with a matching title or description.
#
# This method uses ILIKE on PostgreSQL and LIKE on MySQL.