diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a7b077df..3d869783 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,7 +8,8 @@ Changelog - D3 7.3.0 support - Updated clipboardJS to 2.0.10 - d3plus 2.0.1 support -- support controller_issues_edit_after_save hook for status change and assign to me +- introduce hooks controller_additionals_assign_to_me_before_save, controller_additionals_assign_to_me_after_save (see #127) +- introduce hooks controller_additionals_change_status_before_save, controller_additionals_change_status_after_save (see #127) 3.0.4 +++++ diff --git a/app/controllers/additionals_assign_to_me_controller.rb b/app/controllers/additionals_assign_to_me_controller.rb index 999d188e..37bf7a3f 100644 --- a/app/controllers/additionals_assign_to_me_controller.rb +++ b/app/controllers/additionals_assign_to_me_controller.rb @@ -16,15 +16,20 @@ class AdditionalsAssignToMeController < ApplicationController @issue.init_journal User.current @issue.assigned_to = User.current + call_hook :controller_additionals_assign_to_me_before_save, + params: params, + issue: @issue, + journal: @issue.current_journal + if !@issue.save || old_user == @issue.assigned_to flash[:error] = l :error_issues_could_not_be_assigned_to_me return redirect_to(issue_path(@issue)) end - call_hook :controller_issues_edit_after_save, params: params, - issue: @issue, - time_entry: nil, - journal: @issue.current_journal + call_hook :controller_additionals_assign_to_me_after_save, + params: params, + issue: @issue, + journal: @issue.current_journal last_journal = @issue.journals.visible.order(:created_on).last return redirect_to(issue_path(@issue)) unless last_journal diff --git a/app/controllers/additionals_change_status_controller.rb b/app/controllers/additionals_change_status_controller.rb index 0d9ba726..27ef0315 100644 --- a/app/controllers/additionals_change_status_controller.rb +++ b/app/controllers/additionals_change_status_controller.rb @@ -19,15 +19,20 @@ class AdditionalsChangeStatusController < ApplicationController @issue.status_id = new_status_id @issue.assigned_to = User.current if @issue.status_x_affected?(new_status_id) && issue_old_user != User.current + call_hook :controller_additionals_change_status_before_save, + params: params, + issue: @issue, + journal: @issue.current_journal + if !@issue.save || issue_old_status_id == @issue.status_id flash[:error] = l :error_issue_status_could_not_changed return redirect_to(issue_path(@issue)) end - call_hook :controller_issues_edit_after_save, params: params, - issue: @issue, - time_entry: nil, - journal: @issue.current_journal + call_hook :controller_additionals_change_status_after_save, + params: params, + issue: @issue, + journal: @issue.current_journal last_journal = @issue.journals.visible.order(:created_on).last