diff options
Diffstat (limited to 'app/graphql/mutations/issues/create.rb')
-rw-r--r-- | app/graphql/mutations/issues/create.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/app/graphql/mutations/issues/create.rb b/app/graphql/mutations/issues/create.rb index 70a8f539ccf..72b03cc27c2 100644 --- a/app/graphql/mutations/issues/create.rb +++ b/app/graphql/mutations/issues/create.rb @@ -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, |