/ informatica

How to fix redmine-mylyn-connector "Server Error: undefined method `visible_by'"

With version 5324 the method Project.visible_by has been deprecated in favor of Project.visible_condition and redmine-mylyn-connector plugin stopped working with error: Server Error: undefined by `visible_by'.

Here's the patch you need to fix the plugin:

[cc lang="ruby"]diff -r redmine-mylyn-connector-2.7.5/app/controllers/mylyn_connector/issues_controller.rb redmine-mylyn-connector-2.7.5-patched/app/controllers/mylyn_connector/issues_controller.rb
63c63
< :conditions => ["#{Issue.table_name}.id in (?) and #{Issue.table_name}.updated_on >= ? and " < < Project.visible_by, issues, cond]

  :conditions => ["#{Issue.table_name}.id in (?) and #{Issue.table_name}.updated_on >= ? and " < < Project.visible_condition(User.current), issues, cond]

79c79
< :conditions => ["#{Issue.table_name}.id in (?) and " < < Project.visible_by, issues]

  :conditions => ["#{Issue.table_name}.id in (?) and " < < Project.visible_condition(User.current), issues]

diff -r redmine-mylyn-connector-2.7.5/app/controllers/mylyn_connector/projects_controller.rb redmine-mylyn-connector-2.7.5-patched/app/controllers/mylyn_connector/projects_controller.rb
16c16
< :conditions => [ "enabled_modules.name = 'issue_tracking' AND #{Project.visible_by}"])

  :conditions => [ "enabled_modules.name = 'issue_tracking' AND #{Project.visible_condition(User.current)}"])

diff -r redmine-mylyn-connector-2.7.5/app/controllers/mylyn_connector/queries_controller.rb redmine-mylyn-connector-2.7.5-patched/app/controllers/mylyn_connector/queries_controller.rb
18c18
< :conditions => ["(#{Query.table_name}.is_public = ? OR #{Query.table_name}.user_id = ?) AND (project_id IS NULL OR " < < Project.visible_by << ")", true, User.current.id],

  :conditions => ["(#{Query.table_name}.is_public = ? OR #{Query.table_name}.user_id = ?) AND (project_id IS NULL OR "  < < Project.visible_condition(User.current) << ")", true, User.current.id],[/cc]</pre></pre>