diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-02 15:06:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-02 15:06:45 +0300 |
commit | bffcdf9bca11a4d43cc40e3f382f03088d36f7c6 (patch) | |
tree | c773436393b7a59b5f6b14388b9fa6402a9bd198 /app/services | |
parent | 259c0cc0c4f8a49001b33d1bee577f4422e16d62 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/error_tracking/list_issues_service.rb | 47 |
1 files changed, 11 insertions, 36 deletions
diff --git a/app/services/error_tracking/list_issues_service.rb b/app/services/error_tracking/list_issues_service.rb index a2c8e6e6619..132e9dfa7bd 100644 --- a/app/services/error_tracking/list_issues_service.rb +++ b/app/services/error_tracking/list_issues_service.rb @@ -6,37 +6,24 @@ module ErrorTracking DEFAULT_LIMIT = 20 DEFAULT_SORT = 'last_seen' - def execute - return error('Error Tracking is not enabled') unless enabled? - return error('Access denied', :unauthorized) unless can_read? - - result = project_error_tracking_setting.list_sentry_issues( - issue_status: issue_status, - limit: limit, - search_term: search_term, - sort: sort - ) - - # our results are not yet ready - unless result - return error('Not ready. Try again later', :no_content) - end - - if result[:error].present? - return error(result[:error], http_status_for(result[:error_type])) - end - - success(issues: result[:issues]) - end - def external_url project_error_tracking_setting&.sentry_external_url end private + def fetch + project_error_tracking_setting.list_sentry_issues( + issue_status: issue_status, + limit: limit, + search_term: params[:search_term].presence, + sort: sort, + cursor: params[:cursor].presence + ) + end + def parse_response(response) - { issues: response[:issues] } + response.slice(:issues, :pagination) end def issue_status @@ -47,18 +34,6 @@ module ErrorTracking params[:limit] || DEFAULT_LIMIT end - def search_term - params[:search_term].presence - end - - def enabled? - project_error_tracking_setting&.enabled? - end - - def can_read? - can?(current_user, :read_sentry_issue, project) - end - def sort params[:sort] || DEFAULT_SORT end |