This commit is contained in:
nilsding 2014-11-13 13:02:47 +01:00
parent 8ae0fc6c22
commit e39f82882b
1 changed files with 4 additions and 3 deletions

View File

@ -1,9 +1,10 @@
module UserHelper module UserHelper
# Decides what user name to show. # Decides what user name to show.
# @return [String] The user name # @return [String] The user name
def user_screen_name(user, anonymous=false) def user_screen_name(user, anonymous=false, url=true)
return APP_CONFIG['anonymous_name'] if user.nil? || anonymous return APP_CONFIG['anonymous_name'] if user.nil? || anonymous
return user.display_name unless user.display_name.blank? name = user.display_name.blank? ? user.screen_name : user.display_name
user.screen_name return link_to(name, show_user_profile_path(current_user.screen_name)) if url
name
end end
end end