2020-01-01 13:55:28 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module Issues
|
|
|
|
class SetConfidential < Base
|
2021-09-30 23:02:18 +05:30
|
|
|
include Mutations::SpamProtection
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
graphql_name 'IssueSetConfidential'
|
|
|
|
|
|
|
|
argument :confidential,
|
2021-10-27 15:23:28 +05:30
|
|
|
GraphQL::Types::Boolean,
|
2020-01-01 13:55:28 +05:30
|
|
|
required: true,
|
|
|
|
description: 'Whether or not to set the issue as a confidential.'
|
|
|
|
|
|
|
|
def resolve(project_path:, iid:, confidential:)
|
|
|
|
issue = authorized_find!(project_path: project_path, iid: iid)
|
|
|
|
project = issue.project
|
2021-09-30 23:02:18 +05:30
|
|
|
# Changing confidentiality affects spam checking rules, therefore we need to provide
|
|
|
|
# spam_params so a check can be performed.
|
|
|
|
spam_params = ::Spam::SpamParams.new_from_request(request: context[:request])
|
2020-01-01 13:55:28 +05:30
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
::Issues::UpdateService.new(project: project, current_user: current_user, params: { confidential: confidential }, spam_params: spam_params)
|
2020-01-01 13:55:28 +05:30
|
|
|
.execute(issue)
|
2021-09-30 23:02:18 +05:30
|
|
|
check_spam_action_response!(issue)
|
2020-01-01 13:55:28 +05:30
|
|
|
|
|
|
|
{
|
|
|
|
issue: issue,
|
2020-06-23 00:09:42 +05:30
|
|
|
errors: errors_on_object(issue)
|
2020-01-01 13:55:28 +05:30
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|