Project

General

Profile

Actions

Defect #26506

closed

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

Added by Go MAEDA over 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Category:
Text formatting
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
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


Files

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

Related issues

Related to Redmine - Feature #23630: Migrate to Rails 5.2ClosedJean-Philippe Lang

Actions
Actions #1

Updated by Go MAEDA over 7 years ago

  • Category set to Text formatting
Actions #2

Updated by Marius BĂLTEANU over 7 years ago

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

Actions #3

Updated by Marius BĂLTEANU over 7 years 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
Actions #4

Updated by Go MAEDA over 7 years 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.

Actions #5

Updated by Go MAEDA over 7 years 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.

error log

Actions #6

Updated by Jean-Philippe Lang over 7 years 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.

Actions #7

Updated by Jean-Philippe Lang over 7 years ago

Actions #8

Updated by Marius BĂLTEANU over 7 years 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.

Actions #9

Updated by Andriy Lesyuk over 6 years ago

Without this change user links in emails are invalid (as they are relative), so please include it into the very next release.

Actions

Also available in: Atom PDF