summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-19 15:06:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-19 15:06:24 +0000
commit88542a5e9613c8442a982e65ad5cf13eb33bc541 (patch)
tree11a65d86e623b443b8a2976cc93cff360e2da8a2 /app/services
parentb570d73ecd31e2ca9cf8c2f1adb056edf2869477 (diff)
downloadgitlab-ce-88542a5e9613c8442a982e65ad5cf13eb33bc541.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services')
-rw-r--r--app/services/error_tracking/list_issues_service.rb34
-rw-r--r--app/services/merge_requests/merge_service.rb2
2 files changed, 34 insertions, 2 deletions
diff --git a/app/services/error_tracking/list_issues_service.rb b/app/services/error_tracking/list_issues_service.rb
index 2e8c401b8ef..0c2183dc36e 100644
--- a/app/services/error_tracking/list_issues_service.rb
+++ b/app/services/error_tracking/list_issues_service.rb
@@ -5,6 +5,28 @@ module ErrorTracking
DEFAULT_ISSUE_STATUS = 'unresolved'
DEFAULT_LIMIT = 20
+ 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
+ )
+
+ # 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
@@ -26,5 +48,17 @@ module ErrorTracking
def limit
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
end
end
diff --git a/app/services/merge_requests/merge_service.rb b/app/services/merge_requests/merge_service.rb
index a45b4f1142e..2eef3eed804 100644
--- a/app/services/merge_requests/merge_service.rb
+++ b/app/services/merge_requests/merge_service.rb
@@ -62,8 +62,6 @@ module MergeRequests
end
def updated_check!
- return unless Feature.enabled?(:validate_merge_sha, merge_request.target_project, default_enabled: false)
-
unless source_matches?
raise_error('Branch has been updated since the merge was requested. '\
'Please review the changes.')