mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 01:15:26 +08:00
REFACTOR: Add full_url
and display_name
to User
Lets stop writing the same code over and over again.
This commit is contained in:

committed by
Gerhard Schlager

parent
650adbe423
commit
b3cda195b8
@ -1461,6 +1461,18 @@ class User < ActiveRecord::Base
|
||||
username_lower == User.normalize_username(another_username)
|
||||
end
|
||||
|
||||
def full_url
|
||||
"#{Discourse.base_url}/u/#{encoded_username}"
|
||||
end
|
||||
|
||||
def display_name
|
||||
if SiteSetting.prioritize_username_in_ux?
|
||||
username
|
||||
else
|
||||
name.presence || username
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def badge_grant
|
||||
|
Reference in New Issue
Block a user