Commit fddd98bf authored by Felipe Artur's avatar Felipe Artur

Show captcha verification on issue boards

Show captcha verification modal when
creating issues from boards.

Changelog: fixed
parent 584868af
......@@ -3,13 +3,14 @@
module Mutations
module Issues
class Create < BaseMutation
include Mutations::SpamProtection
include FindsProject
include CommonMutationArguments
graphql_name 'CreateIssue'
authorize :create_issue
include CommonMutationArguments
argument :project_path, GraphQL::Types::ID,
required: true,
description: 'Project full path the issue is associated with.'
......@@ -76,9 +77,7 @@ module Mutations
spam_params = ::Spam::SpamParams.new_from_request(request: context[:request])
issue = ::Issues::CreateService.new(project: project, current_user: current_user, params: params, spam_params: spam_params).execute
if issue.spam?
issue.errors.add(:base, 'Spam detected.')
end
check_spam_action_response!(issue)
{
issue: issue.valid? ? issue : nil,
......
......@@ -48,5 +48,9 @@ RSpec.describe 'Create an issue' do
expect(mutation_response['issue']).to include('discussionLocked' => true)
expect(Issue.last.work_item_type.base_type).to eq('issue')
end
it_behaves_like 'has spam protection' do
let(:mutation_class) { ::Mutations::Issues::Create }
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment