Class: Mutations::Issues::SetAssignees

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

Constant Summary

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 Assignable

#resolve

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

#assign!(issue, users, mode) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/graphql/mutations/issues/set_assignees.rb', line 10

def assign!(issue, users, mode)
  permitted, forbidden = users.partition { |u| u.can?(:read_issue, issue) }

  super(issue, permitted, mode)

  forbidden.each do |user|
    issue.errors.add(
      :assignees,
      "Cannot assign #{user.to_reference} to #{issue.to_reference}"
    )
  end
end

#update_service_classObject



23
24
25
# File 'app/graphql/mutations/issues/set_assignees.rb', line 23

def update_service_class
  ::Issues::UpdateService
end