MayamaTakeshi / redmine_rt

Redmine plugin for Real-Time notification of events
GNU General Public License v3.0
24 stars 4 forks source link

Stop patching model Issue #45

Open MayamaTakeshi opened 1 year ago

MayamaTakeshi commented 1 year ago

Similar to #44. But I don't know yet if this can also cause conflicts.

Instead of a patch maybe we should use hooks like this:

class IssueHook < Redmine::Hook::Listener
  def controller_issues_new_after_save(context = {})
    Rails.logger.info "controller_issues_new_after_save"
    issue = context[:issue]
    unless issue.blank?
      update_custom_field(issue)
    end
  end
... ABRIDGED...
end

https://github.com/yimanishi/redmine_after_save/blob/master/lib/after_save_issue_hooks.rb

But before doing it it is better to try to reproduce a conflict (or wait someone to report it).