Commit ed67ba966336c71583229063a12553f432643d64
1 parent
cc773654
Exists in
spb-stable
and in
3 other branches
Add support for close/reopen actions in update service
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
2 changed files
with
11 additions
and
2 deletions
Show diff stats
app/services/issues/reopen_service.rb
app/services/issues/update_service.rb
| 1 | 1 | module Issues |
| 2 | 2 | class UpdateService < BaseService |
| 3 | 3 | def execute(issue) |
| 4 | - if issue.update_attributes(params) | |
| 4 | + state = params.delete('state_event') | |
| 5 | + | |
| 6 | + case state | |
| 7 | + when 'reopen' | |
| 8 | + Issues::ReopenService.new(project, current_user, {}).execute(issue) | |
| 9 | + when 'close' | |
| 10 | + Issues::CloseService.new(project, current_user, {}).execute(issue) | |
| 11 | + end | |
| 12 | + | |
| 13 | + if params.present? && issue.update_attributes(params) | |
| 5 | 14 | issue.reset_events_cache |
| 6 | 15 | |
| 7 | 16 | if issue.is_being_reassigned? | ... | ... |