hook.patch

Martin Malek, 2016-11-03 16:38

Download (1.35 KB)

View differences:

app/models/mail_handler.rb
18 18
class MailHandler < ActionMailer::Base
19 19
  include ActionView::Helpers::SanitizeHelper
20 20
  include Redmine::I18n
21
  include Redmine::Hook::Helper
21 22

  
22 23
  class UnauthorizedAction < StandardError; end
23 24
  class MissingInformation < StandardError; end
......
218 219

  
219 220
    # add To and Cc as watchers before saving so the watchers can reply to Redmine
220 221
    add_watchers(issue)
222
    call_hook(:controller_issues_new_before_save, { :issue => issue })
221 223
    issue.save!
222 224
    add_attachments(issue)
225
    call_hook(:controller_issues_new_after_save, { :issue => issue })
223 226
    logger.info "MailHandler: issue ##{issue.id} created by #{user}" if logger
224 227
    issue
225 228
  end
......
251 254
    # add To and Cc as watchers before saving so the watchers can reply to Redmine
252 255
    add_watchers(issue)
253 256
    add_attachments(issue)
257
    call_hook(:controller_issues_edit_before_save, { :issue => issue, :journal => journal})
254 258
    issue.save!
259
    call_hook(:controller_issues_edit_after_save, { :issue => issue, :journal => journal})
255 260
    if logger
256 261
      logger.info "MailHandler: issue ##{issue.id} updated by #{user}"
257 262
    end