MayamaTakeshi / redmine_rt

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

Incompatible with redmine_checklists #33

Closed MayamaTakeshi closed 1 year ago

MayamaTakeshi commented 1 year ago

When I have this plugin installed and click 'Submit' on the Edit window, this happens:

NoMethodError in IssuesController#update
undefined method `checklists' for nil:NilClass
Extracted source (around line #53):

51
52        def save_before_state
53          @issue.old_checklists = @issue.checklists.to_json
54          checklists_params = params[:issue].present? && params[:issue][:checklists_attributes].present? ? params[:issue][:checklists_attributes] : {}
55          @issue.removed_checklist_ids =
56            if checklists_params.present?

We can see this plugin have this patch:

$ find . -type f|xargs grep save_before_state
./redmine_checklists/lib/redmine_checklists/patches/issues_controller_patch.rb:          before_action :save_before_state, :only => [:update]
./redmine_checklists/lib/redmine_checklists/patches/issues_controller_patch.rb:        def save_before_state
$ 

It does some patching in issues_controller that seem to be incompatible with redmine_rt.

MayamaTakeshi commented 1 year ago

It seems there are issues when more than one plugin patches the same controller (in this case, IssuesController). In particular, calling the before_action methods. I removed those from my patch and it seems OK now.