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.
-
#requesting_user ⇒ Object
readonly
Returns the value of attribute requesting_user.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(user, entity, requesting_user) ⇒ UnassignIssuablesService
constructor
A new instance of UnassignIssuablesService.
Constructor Details
#initialize(user, entity, requesting_user) ⇒ UnassignIssuablesService
Returns a new instance of UnassignIssuablesService.
10 11 12 13 14 |
# File 'app/services/members/unassign_issuables_service.rb', line 10 def initialize(user, entity, requesting_user) @user = user @requesting_user = requesting_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 |
#requesting_user ⇒ Object (readonly)
Returns the value of attribute requesting_user.
5 6 7 |
# File 'app/services/members/unassign_issuables_service.rb', line 5 def requesting_user @requesting_user 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
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/services/members/unassign_issuables_service.rb', line 16 def execute raise ArgumentError, 'requesting_user must be given' unless requesting_user return unless entity && user project_ids = entity.is_a?(Group) ? entity.all_projects.select(:id) : [entity.id] unassign_from_issues(project_ids) unassign_from_merge_requests(project_ids) user.invalidate_cache_counts end |