mirror of
https://github.com/discourse/discourse.git
synced 2025-04-29 21:44:38 +08:00
Shorten User.suggest_name
further.
This commit is contained in:
parent
8238097d0f
commit
b3981ddc43
@ -288,9 +288,7 @@ class User < ActiveRecord::Base
|
|||||||
|
|
||||||
def self.suggest_name(string)
|
def self.suggest_name(string)
|
||||||
return "" if string.blank?
|
return "" if string.blank?
|
||||||
local_part = string[/\A[^@]+/]
|
(string[/\A[^@]+/].presence || string[/[^@]+\z/]).tr(".", " ").titleize
|
||||||
suggestion = local_part.present? ? local_part : string[/[^@]+\z/]
|
|
||||||
suggestion.tr(".", " ").titleize
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.find_by_username_or_email(username_or_email)
|
def self.find_by_username_or_email(username_or_email)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user