summaryrefslogtreecommitdiff
path: root/app/services/projects
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 15:09:30 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-07 15:09:30 +0000
commitc6b3ec3f56fa32a0e0ed3de0d0878d25f1adaddf (patch)
tree967afee9a510ff9dd503ebd83706dc760ec2e3ed /app/services/projects
parent903ccf7c93eb9490c76857bffe744249cc07de09 (diff)
downloadgitlab-ce-c6b3ec3f56fa32a0e0ed3de0d0878d25f1adaddf.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/projects')
-rw-r--r--app/services/projects/alerting/notify_service.rb6
-rw-r--r--app/services/projects/import_export/export_service.rb7
-rw-r--r--app/services/projects/prometheus/alerts/notify_service.rb20
3 files changed, 20 insertions, 13 deletions
diff --git a/app/services/projects/alerting/notify_service.rb b/app/services/projects/alerting/notify_service.rb
index d34d6f6a915..1ce1ef7a1cd 100644
--- a/app/services/projects/alerting/notify_service.rb
+++ b/app/services/projects/alerting/notify_service.rb
@@ -46,15 +46,15 @@ module Projects
end
def bad_request
- ServiceResponse.error(message: 'Bad Request', http_status: 400)
+ ServiceResponse.error(message: 'Bad Request', http_status: :bad_request)
end
def unauthorized
- ServiceResponse.error(message: 'Unauthorized', http_status: 401)
+ ServiceResponse.error(message: 'Unauthorized', http_status: :unauthorized)
end
def forbidden
- ServiceResponse.error(message: 'Forbidden', http_status: 403)
+ ServiceResponse.error(message: 'Forbidden', http_status: :forbidden)
end
end
end
diff --git a/app/services/projects/import_export/export_service.rb b/app/services/projects/import_export/export_service.rb
index fa098e7417c..8893bf18e1f 100644
--- a/app/services/projects/import_export/export_service.rb
+++ b/app/services/projects/import_export/export_service.rb
@@ -58,12 +58,7 @@ module Projects
end
def tree_saver_class
- if ::Feature.enabled?(:streaming_serializer, project, default_enabled: true)
- Gitlab::ImportExport::Project::TreeSaver
- else
- # Once we remove :streaming_serializer feature flag, Project::LegacyTreeSaver should be removed as well
- Gitlab::ImportExport::Project::LegacyTreeSaver
- end
+ Gitlab::ImportExport::Project::TreeSaver
end
def uploads_saver
diff --git a/app/services/projects/prometheus/alerts/notify_service.rb b/app/services/projects/prometheus/alerts/notify_service.rb
index 89791aecabb..6ebc061c2e3 100644
--- a/app/services/projects/prometheus/alerts/notify_service.rb
+++ b/app/services/projects/prometheus/alerts/notify_service.rb
@@ -8,15 +8,15 @@ module Projects
include IncidentManagement::Settings
def execute(token)
- return false unless valid_payload_size?
- return false unless valid_version?
- return false unless valid_alert_manager_token?(token)
+ return bad_request unless valid_payload_size?
+ return unprocessable_entity unless valid_version?
+ return unauthorized unless valid_alert_manager_token?(token)
persist_events
send_alert_email if send_email?
process_incident_issues if process_issues?
- true
+ ServiceResponse.success
end
private
@@ -118,6 +118,18 @@ module Projects
def persist_events
CreateEventsService.new(project, nil, params).execute
end
+
+ def bad_request
+ ServiceResponse.error(message: 'Bad Request', http_status: :bad_request)
+ end
+
+ def unauthorized
+ ServiceResponse.error(message: 'Unauthorized', http_status: :unauthorized)
+ end
+
+ def unprocessable_entity
+ ServiceResponse.error(message: 'Unprocessable Entity', http_status: :unprocessable_entity)
+ end
end
end
end