2020-10-24 23:57:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module Issues
|
|
|
|
class SetAssignees < Base
|
|
|
|
graphql_name 'IssueSetAssignees'
|
|
|
|
|
|
|
|
include Assignable
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
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-10-24 23:57:45 +05:30
|
|
|
def update_service_class
|
|
|
|
::Issues::UpdateService
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|