PLT-3470: Changed all instances of user list to show full name, username, and nickname (#6994)

Этот коммит содержится в:
Jonathan
2017-07-24 08:22:19 -04:00
коммит произвёл Harrison Healey
родитель b27d51d512
Коммит 87746227bf
5 изменённых файлов: 43 добавлений и 14 удалений

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

@@ -1003,10 +1003,16 @@ export function getDisplayName(user) {
return user.username;
}
/**
* Gets the display name of the user with the specified id, respecting the TeammateNameDisplay configuration setting
*/
export function displayUsername(userId) {
return displayUsernameForUser(UserStore.getProfile(userId));
}
/**
* Gets the display name of the specified user, respecting the TeammateNameDisplay configuration setting
*/
export function displayUsernameForUser(user) {
if (user) {
const nameFormat = global.window.mm_config.TeammateNameDisplay;
@@ -1023,6 +1029,35 @@ export function displayUsernameForUser(user) {
return '';
}
/**
* Gets the entire name, including username, full name, and nickname, of the user with the specified id
*/
export function displayEntireName(userId) {
return displayEntireNameForUser(UserStore.getProfile(userId));
}
/**
* Gets the entire name, including username, full name, and nickname, of the specified user
*/
export function displayEntireNameForUser(user) {
if (!user) {
return '';
}
let displayName = user.username;
const fullName = getFullName(user);
if (fullName && user.nickname) {
displayName += ` - ${fullName} (${user.nickname})`;
} else if (fullName) {
displayName += ` - ${fullName}`;
} else if (user.nickname) {
displayName += ` - ${user.nickname}`;
}
return displayName;
}
export function imageURLForUser(userIdOrObject) {
if (typeof userIdOrObject == 'string') {
const profile = UserStore.getProfile(userIdOrObject);