Class: Members::UnassignIssuablesService
- Inherits:
-
Object
- Object
- Members::UnassignIssuablesService
- Defined in:
- app/services/members/unassign_issuables_service.rb
Instance Attribute Summary collapse
-
#entity ⇒ Object
readonly
Returns the value of attribute entity.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(user, entity) ⇒ UnassignIssuablesService
constructor
A new instance of UnassignIssuablesService.
Constructor Details
#initialize(user, entity) ⇒ UnassignIssuablesService
Returns a new instance of UnassignIssuablesService.
7 8 9 10 |
# File 'app/services/members/unassign_issuables_service.rb', line 7 def initialize(user, entity) @user = user @entity = entity end |
Instance Attribute Details
#entity ⇒ Object (readonly)
Returns the value of attribute entity.
5 6 7 |
# File 'app/services/members/unassign_issuables_service.rb', line 5 def entity @entity end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
5 6 7 |
# File 'app/services/members/unassign_issuables_service.rb', line 5 def user @user end |
Instance Method Details
#execute ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'app/services/members/unassign_issuables_service.rb', line 12 def execute return unless entity && user project_ids = entity.is_a?(Group) ? entity.all_projects.select(:id) : [entity.id] user.issue_assignees.on_issues(Issue.in_projects(project_ids).select(:id)).delete_all user.merge_request_assignees.in_projects(project_ids).delete_all user.invalidate_cache_counts end |