Patch #25261 » 0001-Fix-issue-with-not-call_hook-in-MailHandler.patch
| app/controllers/mail_handler_controller.rb | ||
|---|---|---|
|
# 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
|
||
| ... | ... | |
|
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
|
||
| ... | ... | |
|
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
|
||