mirror of
https://github.com/redmine/redmine.git
synced 2025-11-06 21:35:46 +01:00
Fixed link to user in email notifications (#26506).
git-svn-id: http://svn.redmine.org/redmine/trunk@16876 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -53,7 +53,8 @@ module ApplicationHelper
|
||||
if user.is_a?(User)
|
||||
name = h(user.name(options[:format]))
|
||||
if user.active? || (User.current.admin? && user.logged?)
|
||||
link_to name, user_path(user), :class => user.css_classes
|
||||
only_path = options[:only_path].nil? ? true : options[:only_path]
|
||||
link_to name, user_url(user, :only_path => only_path), :class => user.css_classes
|
||||
else
|
||||
name
|
||||
end
|
||||
@@ -905,7 +906,7 @@ module ApplicationHelper
|
||||
end
|
||||
when 'user'
|
||||
u = User.visible.where(:id => oid, :type => 'User').first
|
||||
link = link_to_user(u) if u
|
||||
link = link_to_user(u, :only_path => only_path) if u
|
||||
end
|
||||
elsif sep == ':'
|
||||
name = remove_double_quotes(identifier)
|
||||
@@ -966,12 +967,12 @@ module ApplicationHelper
|
||||
end
|
||||
when 'user'
|
||||
u = User.visible.where(:login => name, :type => 'User').first
|
||||
link = link_to_user(u) if u
|
||||
link = link_to_user(u, :only_path => only_path) if u
|
||||
end
|
||||
elsif sep == "@"
|
||||
name = remove_double_quotes(identifier)
|
||||
u = User.visible.where(:login => name, :type => 'User').first
|
||||
link = link_to_user(u) if u
|
||||
link = link_to_user(u, :only_path => only_path) if u
|
||||
end
|
||||
end
|
||||
(leading + (link || "#{project_prefix}#{prefix}#{repo_prefix}#{sep}#{identifier}#{comment_suffix}"))
|
||||
|
||||
@@ -193,6 +193,14 @@ class MailerTest < ActiveSupport::TestCase
|
||||
Redmine::Utils.relative_url_root = relative_url_root
|
||||
end
|
||||
|
||||
def test_link_to_user_in_email
|
||||
issue = Issue.generate!(:description => '@jsmith')
|
||||
assert Mailer.deliver_issue_add(issue)
|
||||
assert_select_email do
|
||||
assert_select "a[href=?]", "http://localhost:3000/users/2", :text => 'John Smith'
|
||||
end
|
||||
end
|
||||
|
||||
def test_email_headers
|
||||
issue = Issue.find(1)
|
||||
Mailer.deliver_issue_add(issue)
|
||||
|
||||
Reference in New Issue
Block a user