debian-mirror-gitlab/app/finders/issues_finder/params.rb

49 lines
1.3 KiB
Ruby
Raw Normal View History

2020-04-22 19:07:51 +05:30
# frozen_string_literal: true
class IssuesFinder
class Params < IssuableFinder::Params
def public_only?
params.fetch(:public_only, false)
end
def filter_by_no_due_date?
due_date? && params[:due_date] == Issue::NoDueDate.name
end
def filter_by_overdue?
due_date? && params[:due_date] == Issue::Overdue.name
end
def filter_by_due_this_week?
due_date? && params[:due_date] == Issue::DueThisWeek.name
end
def filter_by_due_this_month?
due_date? && params[:due_date] == Issue::DueThisMonth.name
end
def filter_by_due_next_month_and_previous_two_weeks?
due_date? && params[:due_date] == Issue::DueNextMonthAndPreviousTwoWeeks.name
end
def user_can_see_all_confidential_issues?
2020-07-28 23:09:34 +05:30
strong_memoize(:user_can_see_all_confidential_issues) do
parent = project? ? project : group
if parent
Ability.allowed?(current_user, :read_confidential_issues, parent)
2020-04-22 19:07:51 +05:30
else
2020-07-28 23:09:34 +05:30
Ability.allowed?(current_user, :read_all_resources)
2020-04-22 19:07:51 +05:30
end
2020-07-28 23:09:34 +05:30
end
2020-04-22 19:07:51 +05:30
end
def user_cannot_see_confidential_issues?
return false if user_can_see_all_confidential_issues?
current_user.blank?
end
end
end
2021-06-08 01:23:25 +05:30
IssuesFinder::Params.prepend_mod_with('IssuesFinder::Params')