From aff7877d9cb760b0357dae85acea3c5fa4cd8621 Mon Sep 17 00:00:00 2001 From: Olexandr Hoshylyk Date: Sun, 5 Mar 2017 13:38:51 +0200 Subject: [PATCH] Fix issue with not call_hook in MailHandler --- app/controllers/mail_handler_controller.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controllers/mail_handler_controller.rb b/app/controllers/mail_handler_controller.rb index 82ca7cc..990753d 100644 --- a/app/controllers/mail_handler_controller.rb +++ b/app/controllers/mail_handler_controller.rb @@ -16,6 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class MailHandlerController < ActionController::Base + include Redmine::Hook::Helper before_action :check_credential # Displays the email submission form @@ -26,7 +27,8 @@ class MailHandlerController < ActionController::Base def index options = params.dup email = options.delete(:email) - if MailHandler.receive(email, options) + if object = MailHandler.receive(email, options) + call_issues_hook(object) head :created else head :unprocessable_entity @@ -41,4 +43,13 @@ class MailHandlerController < ActionController::Base render :plain => 'Access denied. Incoming emails WS is disabled or key is invalid.', :status => 403 end end + + def call_issues_hook(object) + case object + when Issue + call_hook(:controller_issues_new_after_save, { :params => params, :issue => object }) + when Journal + call_hook(:controller_issues_edit_after_save, { :params => params, :issue => object.issue, :journal => object }) + end + end end -- 2.7.4