mirror of
https://github.com/redmine/redmine.git
synced 2026-07-05 08:39:22 +02:00
Fixes ApplicationHelper#link_to_user
* No link to a locked user page (closes #4182) * Translate Anonymous string git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3024 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -44,12 +44,17 @@ module ApplicationHelper
|
||||
link_to_remote(name, options, html_options) if authorize_for(url[:controller] || params[:controller], url[:action])
|
||||
end
|
||||
|
||||
# Display a link to user's account page
|
||||
# Displays a link to user's account page if active
|
||||
def link_to_user(user, options={})
|
||||
if user.is_a?(User)
|
||||
!user.anonymous? ? link_to(user.name(options[:format]), :controller => 'users', :action => 'show', :id => user) : 'Anonymous'
|
||||
name = h(user.name(options[:format]))
|
||||
if user.active?
|
||||
link_to name, :controller => 'users', :action => 'show', :id => user
|
||||
else
|
||||
name
|
||||
end
|
||||
else
|
||||
user.to_s
|
||||
h(user.to_s)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -346,7 +346,7 @@ class AnonymousUser < User
|
||||
# Overrides a few properties
|
||||
def logged?; false end
|
||||
def admin; false end
|
||||
def name; 'Anonymous' end
|
||||
def name(*args); I18n.t(:label_user_anonymous) end
|
||||
def mail; nil end
|
||||
def time_zone; nil end
|
||||
def rss_key; nil end
|
||||
|
||||
Reference in New Issue
Block a user