summaryrefslogtreecommitdiff
path: root/app/graphql/mutations
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-20 18:06:35 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-20 18:06:35 +0000
commit2b3007dc9603b847b15f69bc980847be3b9fa6d1 (patch)
tree26e7556dd285fb593ffa335b689e66fb8022d936 /app/graphql/mutations
parent434a995573f6e5cad4e4742af8d1d83d719f39ca (diff)
downloadgitlab-ce-2b3007dc9603b847b15f69bc980847be3b9fa6d1.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/graphql/mutations')
-rw-r--r--app/graphql/mutations/base_mutation.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/graphql/mutations/base_mutation.rb b/app/graphql/mutations/base_mutation.rb
index 7273a74cb86..623f7c27584 100644
--- a/app/graphql/mutations/base_mutation.rb
+++ b/app/graphql/mutations/base_mutation.rb
@@ -5,6 +5,8 @@ module Mutations
prepend Gitlab::Graphql::Authorize::AuthorizeResource
prepend Gitlab::Graphql::CopyFieldDescription
+ ERROR_MESSAGE = 'You cannot perform write operations on a read-only instance'
+
field :errors, [GraphQL::STRING_TYPE],
null: false,
description: "Reasons why the mutation failed."
@@ -17,5 +19,13 @@ module Mutations
def errors_on_object(record)
record.errors.full_messages
end
+
+ def ready?(**args)
+ if Gitlab::Database.read_only?
+ raise Gitlab::Graphql::Errors::ResourceNotAvailable, ERROR_MESSAGE
+ else
+ true
+ end
+ end
end
end