introduce hooks for issue change

This commit is contained in:
Alexander Meindl 2022-03-12 14:58:45 +01:00
parent 61f69f812f
commit ca0642adc4
3 changed files with 20 additions and 9 deletions

View File

@ -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
+++++

View File

@ -16,14 +16,19 @@ 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,
call_hook :controller_additionals_assign_to_me_after_save,
params: params,
issue: @issue,
time_entry: nil,
journal: @issue.current_journal
last_journal = @issue.journals.visible.order(:created_on).last

View File

@ -19,14 +19,19 @@ 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,
call_hook :controller_additionals_change_status_after_save,
params: params,
issue: @issue,
time_entry: nil,
journal: @issue.current_journal
last_journal = @issue.journals.visible.order(:created_on).last