Patch #25261 » 0001-Fix-issue-with-not-call_hook-in-MailHandler.patch
app/controllers/mail_handler_controller.rb | ||
---|---|---|
16 | 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | 17 | |
18 | 18 |
class MailHandlerController < ActionController::Base |
19 |
include Redmine::Hook::Helper |
|
19 | 20 |
before_action :check_credential |
20 | 21 | |
21 | 22 |
# Displays the email submission form |
... | ... | |
26 | 27 |
def index |
27 | 28 |
options = params.dup |
28 | 29 |
email = options.delete(:email) |
29 |
if MailHandler.receive(email, options) |
|
30 |
if object = MailHandler.receive(email, options) |
|
31 |
call_issues_hook(object) |
|
30 | 32 |
head :created |
31 | 33 |
else |
32 | 34 |
head :unprocessable_entity |
... | ... | |
41 | 43 |
render :plain => 'Access denied. Incoming emails WS is disabled or key is invalid.', :status => 403 |
42 | 44 |
end |
43 | 45 |
end |
46 | ||
47 |
def call_issues_hook(object) |
|
48 |
case object |
|
49 |
when Issue |
|
50 |
call_hook(:controller_issues_new_after_save, { :params => params, :issue => object }) |
|
51 |
when Journal |
|
52 |
call_hook(:controller_issues_edit_after_save, { :params => params, :issue => object.issue, :journal => object }) |
|
53 |
end |
|
54 |
end |
|
44 | 55 |
end |