Unify all locations where we determine a user's display named based off of their nickname/username into a helper function

Этот коммит содержится в:
hmhealey
2015-07-13 17:47:57 -04:00
родитель abcb44089c
Коммит 098cbcdc21
6 изменённых файлов: 34 добавлений и 12 удалений

Просмотреть файл

@@ -237,6 +237,14 @@ func (u *User) AddNotifyProp(key string, value string) {
u.NotifyProps[key] = value
}
func (u *User) GetDisplayName() string {
if u.Nickname != "" {
return u.Nickname
} else {
return u.Username
}
}
// UserFromJson will decode the input and return a User
func UserFromJson(data io.Reader) *User {
decoder := json.NewDecoder(data)