Class: Mutations::Issues::SetConfidential

Inherits:
Base
  • Object
show all
Includes:
SpamProtection
Defined in:
app/graphql/mutations/issues/set_confidential.rb

Constant Summary

Constants included from SpamProtection

SpamProtection::NEEDS_CAPTCHA_RESPONSE_MESSAGE, SpamProtection::NeedsCaptchaResponseError, SpamProtection::SPAM_DISALLOWED_MESSAGE, SpamProtection::SpamActionError, SpamProtection::SpamDisallowedError

Constants inherited from BaseMutation

BaseMutation::ERROR_MESSAGE

Constants included from Gitlab::Graphql::Authorize::AuthorizeResource

Gitlab::Graphql::Authorize::AuthorizeResource::ConfigurationError, Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR

Instance Method Summary collapse

Methods included from Spam::Concerns::HasSpamActionResponseFields

#spam_action_response_fields

Methods included from ResolvesIssuable

#resolve_issuable

Methods inherited from BaseMutation

#api_user?, authorization, authorized?, authorizes_object?, #current_user, #errors_on_object, #load_application_object, #read_only?, #ready?, #unauthorized_object

Methods included from Gitlab::Graphql::Authorize::AuthorizeResource

#authorize!, #authorized_find!, #authorized_resource?, #find_object, #raise_resource_not_available_error!

Instance Method Details

#resolve(project_path:, iid:, confidential:) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/graphql/mutations/issues/set_confidential.rb', line 15

def resolve(project_path:, iid:, confidential:)
  issue = authorized_find!(project_path: project_path, iid: iid)
  project = issue.project
  # Changing confidentiality affects spam checking rules, therefore we need to perform a spam check
  ::Issues::UpdateService.new(container: project, current_user: current_user, params: { confidential: confidential }, perform_spam_check: true)
    .execute(issue)
  check_spam_action_response!(issue)

  {
    issue: issue.reset,
    errors: errors_on_object(issue)
  }
end