diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-11 21:08:09 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-11 21:08:09 +0000 |
commit | fdc26e021b1e3eea4161bf6891f3a151fb7414b0 (patch) | |
tree | f06ce58930f41f8d031e827df198fed5dfab09be /app/finders | |
parent | 11df4bf91b8cf9ac7bb601241992e300eebf684c (diff) | |
download | gitlab-ce-fdc26e021b1e3eea4161bf6891f3a151fb7414b0.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/error_tracking/errors_finder.rb | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/app/finders/error_tracking/errors_finder.rb b/app/finders/error_tracking/errors_finder.rb deleted file mode 100644 index c361d6e2fc2..00000000000 --- a/app/finders/error_tracking/errors_finder.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -module ErrorTracking - class ErrorsFinder - def initialize(current_user, project, params) - @current_user = current_user - @project = project - @params = params - end - - def execute - return ErrorTracking::Error.none unless authorized? - - collection = project.error_tracking_errors - collection = by_status(collection) - collection = sort(collection) - - collection.keyset_paginate(cursor: params[:cursor], per_page: limit) - end - - private - - attr_reader :current_user, :project, :params - - def by_status(collection) - if params[:status].present? && ErrorTracking::Error.statuses.key?(params[:status]) - collection.for_status(params[:status]) - else - collection - end - end - - def authorized? - Ability.allowed?(current_user, :read_sentry_issue, project) - end - - def sort(collection) - params[:sort] ? collection.sort_by_attribute(params[:sort]) : collection.order_id_desc - end - - def limit - # Restrict the maximum limit at 100 records. - [(params[:limit] || 20).to_i, 100].min - end - end -end |