Defect #26506
User link syntax causes an exception while sending email notification on Rails 5.1
Status: | Closed | Start date: | ||
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | % Done: | 0% | ||
Category: | Text formatting | |||
Target version: | - | |||
Resolution: | Fixed | Affected version: |
Description
Steps to reproduce:
- Open "New issue" page.
- Enter something in the subject field.
- Enter "@admin" in the description field.
- Press "Create" button. You will see "NoMethodError" exception (please see the attached screenshot).
Affected version: r16859 and later
Related issues
Associated revisions
Fixed link to user in email notifications (#26506).
History
#1
Updated by Go MAEDA over 1 year ago
- Category set to Text formatting
#2
Updated by Marius BALTEANU over 1 year ago
Indeed, I'm able to reproduce the issue, but I'm not sure how to fix it.
#3
Updated by Marius BALTEANU over 1 year 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 over 1 year 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 over 1 year 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 over 1 year 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 over 1 year ago
- Related to Feature #23630: Migrate to Rails 5.2 added
#8
Updated by Marius BALTEANU over 1 year ago
Jean-Philippe Lang wrote:
This should be fixed in r16876 by using
_url
helper instead of_path
like in otherlink_to_
methods. It also fixed that generated links to users were missing the host name.
Thanks Jean-Philippe Lang for fixing this issue.
#9
Updated by Andriy Lesyuk 11 months ago
Without this change user links in emails are invalid (as they are relative), so please include it into the very next release.