debian-mirror-gitlab/app/graphql/mutations/issues/set_confidential.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
1.1 KiB
Ruby
Raw Normal View History

2020-01-01 13:55:28 +05:30
# frozen_string_literal: true
module Mutations
module Issues
class SetConfidential < Base
graphql_name 'IssueSetConfidential'
2022-04-04 11:22:00 +05:30
include Mutations::SpamProtection
2020-01-01 13:55:28 +05:30
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
{
2022-08-27 11:52:29 +05:30
issue: issue.reset,
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