| ... | @@ -5,6 +5,8 @@ module Mutations |
... | @@ -5,6 +5,8 @@ module Mutations |
|
|
prepend Gitlab::Graphql::Authorize::AuthorizeResource
|
|
prepend Gitlab::Graphql::Authorize::AuthorizeResource
|
|
|
prepend Gitlab::Graphql::CopyFieldDescription
|
|
prepend Gitlab::Graphql::CopyFieldDescription
|
|
|
|
|
|
|
|
|
ERROR_MESSAGE = 'You cannot perform write operations on a read-only instance'
|
|
|
|
|
|
|
field :errors, [GraphQL::STRING_TYPE],
|
|
field :errors, [GraphQL::STRING_TYPE],
|
|
|
null: false,
|
|
null: false,
|
|
|
description: "Reasons why the mutation failed."
|
|
description: "Reasons why the mutation failed."
|
| ... | @@ -17,5 +19,13 @@ module Mutations |
... | @@ -17,5 +19,13 @@ module Mutations |
|
|
def errors_on_object(record)
|
|
def errors_on_object(record)
|
|
|
record.errors.full_messages
|
|
record.errors.full_messages
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
def ready?(**args)
|
|
|
|
if Gitlab::Database.read_only?
|
|
|
|
raise Gitlab::Graphql::Errors::ResourceNotAvailable, ERROR_MESSAGE
|
|
|
|
else
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
|
|
end
|
|
end
|
|
|
end |
|
end |