Defect #26506

User link syntax causes an exception while sending email notification on Rails 5.1

Added by Go MAEDA 6 months ago. Updated 6 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Text formatting
Target version:-
Resolution:Fixed Affected version:

Description

Steps to reproduce:

  1. Open "New issue" page.
  2. Enter something in the subject field.
  3. Enter "@admin" in the description field.
  4. Press "Create" button. You will see "NoMethodError" exception (please see the attached screenshot).

Affected version: r16859 and later

NoMethodError@2x.png - screenshot (45.1 KB) Go MAEDA, 2017-07-24 05:33

development.log (2.73 KB) Go MAEDA, 2017-07-24 05:38


Related issues

Related to Redmine - Feature #23630: Migrate to Rails 5.1 Closed

Associated revisions

Revision 16876
Added by Jean-Philippe Lang 6 months ago

Fixed link to user in email notifications (#26506).

History

#1 Updated by Go MAEDA 6 months ago

  • Category set to Text formatting

#2 Updated by Marius BALTEANU 6 months ago

Indeed, I'm able to reproduce the issue, but I'm not sure how to fix it.

#3 Updated by Marius BALTEANU 6 months ago

Adding "include Rails.application.routes.url_helpers" to ApplicationHelper fixes the issue, but still I'm not sure that is the best solution.

diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e14cff2..e28a446 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -29,6 +29,7 @@ module ApplicationHelper
   include Redmine::Themes::Helper
   include Redmine::Hook::Helper
   include Redmine::Helpers::URL
+  include Rails.application.routes.url_helpers

   extend Forwardable
   def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter

#4 Updated by Go MAEDA 6 months ago

Marius BALTEANU wrote:

Adding "include Rails.application.routes.url_helpers" to ApplicationHelper fixes the issue, but still I'm not sure that is the best solution.

[...]

The issue was fixed by your patch.
Thank you for inspecting it so quickly.

#5 Updated by Go MAEDA 6 months ago

Go MAEDA wrote:

Marius BALTEANU wrote:

Adding "include Rails.application.routes.url_helpers" to ApplicationHelper fixes the issue, but still I'm not sure that is the best solution.

[...]

The issue was fixed by your patch.

Unfortunately some tests fail because of the fix.

#6 Updated by Jean-Philippe Lang 6 months ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Target version deleted (4.0.0)
  • Resolution set to Fixed

This should be fixed in r16876 by using _url helper instead of _path like in other link_to_ methods. It also fixed that generated links to users were missing the host name.

#7 Updated by Jean-Philippe Lang 6 months ago

#8 Updated by Marius BALTEANU 6 months ago

Jean-Philippe Lang wrote:

This should be fixed in r16876 by using _url helper instead of _path like in other link_to_ methods. It also fixed that generated links to users were missing the host name.

Thanks Jean-Philippe Lang for fixing this issue.

Also available in: Atom PDF