display full name, nickname or username in direct messages

Этот коммит содержится в:
Stas Vovk
2015-11-01 01:08:18 +02:00
родитель e646c97f52
Коммит b84af10455
4 изменённых файлов: 120 добавлений и 6 удалений

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

@@ -884,6 +884,23 @@ export function getDisplayName(user) {
return user.username;
}
export function displayUsername(userId) {
const user = UserStore.getProfile(userId);
const nameFormat = PreferenceStore.getPreference(Constants.Preferences.CATEGORY_DISPLAY_SETTINGS, 'name_format', {value: 'false'}).value;
let username;
if (nameFormat === 'nickname_full_name') {
username = user.nickname || getFullName();
} else if (nameFormat === 'full_name') {
username = getFullName();
}
if (!username.trim().length) {
username = user.username;
}
return username;
}
//IE10 does not set window.location.origin automatically so this must be called instead when using it
export function getWindowLocationOrigin() {
var windowLocationOrigin = window.location.origin;