summaryrefslogtreecommitdiffstats
path: root/webapp/utils/utils.jsx
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-06-30 16:06:59 +0800
committerGeorge Goldberg <george@gberg.me>2017-06-30 09:06:59 +0100
commiteea64f8049d90c5dcf14a739d640f5aa6a9c7add (patch)
treefabaa232bad7f4ebddf30b073c37a5962029f7fd /webapp/utils/utils.jsx
parentfb57b3dd53eaca28a557ea7e334e9d7216ce6aab (diff)
downloadchat-eea64f8049d90c5dcf14a739d640f5aa6a9c7add.tar.gz
chat-eea64f8049d90c5dcf14a739d640f5aa6a9c7add.tar.bz2
chat-eea64f8049d90c5dcf14a739d640f5aa6a9c7add.zip
[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
Diffstat (limited to 'webapp/utils/utils.jsx')
-rw-r--r--webapp/utils/utils.jsx20
1 files changed, 9 insertions, 11 deletions
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx
index f35e8cd0f..16edbecdc 100644
--- a/webapp/utils/utils.jsx
+++ b/webapp/utils/utils.jsx
@@ -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'.