2020-08-02 17:10:04 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module Issues
|
|
|
|
class SetAssignees < Base
|
|
|
|
graphql_name 'IssueSetAssignees'
|
|
|
|
|
|
|
|
include Assignable
|
|
|
|
|
2021-04-09 05:09:10 -04:00
|
|
|
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
|
|
|
|
|
2020-08-02 17:10:04 -04:00
|
|
|
def update_service_class
|
|
|
|
::Issues::UpdateService
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|