Restream/redmine_elasticsearch

Empty Assignee search list in issues with Redmine 3.4.2

gc-olivierho opened this issue · 2 comments

After upgrading to Redmine 3.4.2 (from 3.3.3), I got the following behavior:

  1. Go to a project, Issues tab

  2. Filters -> Add Assignee
    Result: the list of assignees to filter on is empty.

  3. Removing redmine_elasticsearch from the plugins fixes the issue

  4. More precisely, removing (commenting) the reference to the gem

'active_model_serializers', '~> 0.8.3'

in the Gemfile fixes the issue.
I'm sorry I can't go further in the analysis, the code of the elasticsearch plugin is far beyond my understanding capabilities :(

For those encountering the same issue, upgrading the above-mentioned gem to version 0.10.7 fixed the issue (changed in the Gemfile to 'active_model_serializers', '~> 0.10.7').
[edited - 2018/04/10] However, active_model_serializers 0.10 does not implement the root member anymore (see rails-api/active_model_serializers#1683), so you'll have to remove the self.root = false in the serializer files.
Moreover, I still haven't succeeded in using ElasticSearch 2.0 with Redmine 3.4.4 so far.

For whoever would like to get the Elasticsearch plugin to work with Redmine 3.4.x, or to debug the current code...
I finally got it to work by reverting the active_model_serializer gem dependency back to version 0.7.0.

The issue with Redmine 3.4.x is that now Redmine retrieves filter data dynamically with ajax calls. In particular, the ajax call to /redmine/queries/filter?project_id=81&type=IssueQuery&name=assigned_to_id
returns a json response instead of an array, when active_model_serializer v 0.8.x is linked.
This does NOT happen with v0.7.0 nor with 0.10.0.
However, as mentioned above, v 0.10.0 lost ascending compatibility by removing access to self.root.

I tried many things in v0.8 to disable serializing for queriesController#filter, but failed with all my attempts.
I tried to understand how to replace the self.root = false in the serializers when using v 0.10.0, but could not find what to do.

So finally, changing the gemfile to reference :
'active_model_serializers', '~> 0.7.0'
was the only way I found to make the redmine_elasticsearch plugin work with Redmine 3.4.x.