debian-mirror-gitlab/app/graphql/mutations/issues/set_assignees.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
605 B
Ruby
Raw Normal View History

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