[PLT-5864] Move teammate name display setting to the System Console (#6681)
* move teammate name display setting to the system console * update all the likes of TeammateNameDisplay names * fix gofmt error * rebase and fix conflict
Этот коммит содержится в:
коммит произвёл
George Goldberg
родитель
fb57b3dd53
Коммит
eea64f8049
@@ -37,8 +37,6 @@ export const Preferences = {
|
||||
CATEGORY_DIRECT_CHANNEL_SHOW: 'direct_channel_show',
|
||||
CATEGORY_GROUP_CHANNEL_SHOW: 'group_channel_show',
|
||||
CATEGORY_DISPLAY_SETTINGS: 'display_settings',
|
||||
DISPLAY_PREFER_NICKNAME: 'nickname_full_name',
|
||||
DISPLAY_PREFER_FULL_NAME: 'full_name',
|
||||
CATEGORY_ADVANCED_SETTINGS: 'advanced_settings',
|
||||
TUTORIAL_STEP: 'tutorial_step',
|
||||
CHANNEL_DISPLAY_MODE: 'channel_display_mode',
|
||||
@@ -970,7 +968,12 @@ export const Constants = {
|
||||
TEST_ID_COUNT: 10,
|
||||
CENTER: 'center',
|
||||
RHS: 'rhs',
|
||||
RHS_ROOT: 'rhsroot'
|
||||
RHS_ROOT: 'rhsroot',
|
||||
TEAMMATE_NAME_DISPLAY: {
|
||||
SHOW_USERNAME: 'username',
|
||||
SHOW_NICKNAME_FULLNAME: 'nickname_full_name',
|
||||
SHOW_FULLNAME: 'full_name'
|
||||
}
|
||||
};
|
||||
|
||||
export default Constants;
|
||||
|
||||
@@ -1015,21 +1015,19 @@ export function displayUsername(userId) {
|
||||
}
|
||||
|
||||
export function displayUsernameForUser(user) {
|
||||
const nameFormat = PreferenceStore.get(Constants.Preferences.CATEGORY_DISPLAY_SETTINGS, 'name_format', 'false');
|
||||
|
||||
let username = '';
|
||||
if (user) {
|
||||
if (nameFormat === Constants.Preferences.DISPLAY_PREFER_NICKNAME) {
|
||||
username = user.nickname || getFullName(user);
|
||||
} else if (nameFormat === Constants.Preferences.DISPLAY_PREFER_FULL_NAME) {
|
||||
username = getFullName(user);
|
||||
}
|
||||
if (!username.trim().length) {
|
||||
username = user.username;
|
||||
const nameFormat = global.window.mm_config.TeammateNameDisplay;
|
||||
let name = user.username;
|
||||
if (nameFormat === Constants.TEAMMATE_NAME_DISPLAY.SHOW_NICKNAME_FULLNAME && user.nickname && user.nickname !== '') {
|
||||
name = user.nickname;
|
||||
} else if ((user.first_name || user.last_name) && (nameFormat === Constants.TEAMMATE_NAME_DISPLAY.SHOW_NICKNAME_FULLNAME || nameFormat === Constants.TEAMMATE_NAME_DISPLAY.SHOW_FULLNAME)) {
|
||||
name = getFullName(user);
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
return username;
|
||||
return null;
|
||||
}
|
||||
|
||||
// Converts a file size in bytes into a human-readable string of the form '123MB'.
|
||||
|
||||
Ссылка в новой задаче
Block a user