Class: MergeRequests::AssignIssuesService
- Inherits:
-
BaseProjectService
- Object
- BaseContainerService
- BaseProjectService
- MergeRequests::AssignIssuesService
- Defined in:
- app/services/merge_requests/assign_issues_service.rb
Instance Attribute Summary
Attributes inherited from BaseProjectService
Attributes inherited from BaseContainerService
#container, #current_user, #group, #params, #project
Instance Method Summary collapse
Methods inherited from BaseProjectService
Methods inherited from BaseContainerService
#group_container?, #initialize, #namespace_container?, #project_container?, #project_group, #root_ancestor
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
This class inherits a constructor from BaseProjectService
Instance Method Details
#assignable_issues ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'app/services/merge_requests/assign_issues_service.rb', line 5 def assignable_issues @assignable_issues ||= if current_user == merge_request. closes_issues.select do |issue| !issue.is_a?(ExternalIssue) && !issue.assignees.present? && can?(current_user, :admin_issue, issue) end else [] end end |
#execute ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/services/merge_requests/assign_issues_service.rb', line 15 def execute assignable_issues.each do |issue| Issues::UpdateService.new(container: issue.project, current_user: current_user, params: { assignee_ids: [current_user.id] }).execute(issue) end { count: assignable_issues.count } end |