diff options
author | Heinrich Lee Yu <hleeyu@gmail.com> | 2018-10-27 05:54:05 +0300 |
---|---|---|
committer | Heinrich Lee Yu <hleeyu@gmail.com> | 2018-11-01 03:36:13 +0300 |
commit | 2d48fc0ee626fb4d9b64936ffe781951308bb1eb (patch) | |
tree | 3aea33684de5cbe7b24a1b5a945f8c8ca212293f /app/finders | |
parent | 085f3500b5cc29790986765403ad667538a50f83 (diff) |
Rearrange code for readability
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/issuable_finder.rb | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index 4dc8c8b8bb1..419f55fe324 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -192,22 +192,6 @@ class IssuableFinder params[:milestone_title].present? end - def filter_by_no_milestone? - [FILTER_NONE, Milestone::None.title].include?(params[:milestone_title].to_s.downcase) - end - - def filter_by_any_milestone? - [FILTER_ANY, Milestone::Any.title].include?(params[:milestone_title].to_s.downcase) - end - - def filter_by_upcoming_milestone? - params[:milestone_title] == Milestone::Upcoming.name - end - - def filter_by_started_milestone? - params[:milestone_title] == Milestone::Started.name - end - def milestones return @milestones if defined?(@milestones) @@ -465,6 +449,24 @@ class IssuableFinder end # rubocop: enable CodeReuse/ActiveRecord + def filter_by_no_milestone? + # Accepts `No Milestone` for compatibility + params[:milestone_title].to_s.downcase == FILTER_NONE || params[:milestone_title] == Milestone::None.title + end + + def filter_by_any_milestone? + # Accepts `Any Milestone` for compatibility + params[:milestone_title].to_s.downcase == FILTER_ANY || params[:milestone_title] == Milestone::Any.title + end + + def filter_by_upcoming_milestone? + params[:milestone_title] == Milestone::Upcoming.name + end + + def filter_by_started_milestone? + params[:milestone_title] == Milestone::Started.name + end + def by_label(items) return items unless labels? |