danmunn / redmine_dmsf

Fork of svn repository for redmine_dmsf
GNU General Public License v2.0
413 stars 193 forks source link

Mailer partial causes deprecation warning: Rendering actions with '.' in the name is deprecated #1518

Closed liaham closed 1 month ago

liaham commented 3 months ago

Especially when running test, redmine_dmsf gives a deprecation warning:

DEPRECATION WARNING: Rendering actions with '.' in the name is deprecated: /path/to/redmine/plugins/redmine_dmsf/app/views/mailer/../../../../../app/views/mailer/_issue.text.erb (called from block in find_all at /path/to/redmine/config/initializers/10-patches.rb:60)

The reason for this warning is this line of code in app/views/mailer/_issue.html.erb:

<%= render partial: "/#{File.dirname(__FILE__)}/../../../../../app/views/mailer/issue.html.erb",
           locals: { issue: issue, issue_url: issue_url, user: user } %>

Writing pathes to partials with '.' in the file name is deprecated since Rails 6.1 and will raise a MissingTemplate with Rails 7.0 (see https://github.com/rails/rails/pull/38858#issuecomment-871748632).

picman commented 1 month ago

Hm, I see the warning but don't know how to fix it. If I remove .html.erb from the path, the template is not found.

picman commented 1 month ago

I think that I've finally found a solution....

liaham commented 1 month ago

Very good idea to extend the view_path temporarily! Looks good to me.