Commit a4421f44 authored by Jordi Mallach's avatar Jordi Mallach 🔥 Committed by Jordi Mallach

Add an option to show nicknames if set, or usernames.

Signed-Off-By: Jordi Mallach's avatarJordi Mallach <jordi.mallach@collabora.com>
Signed-Off-By: Maxime Buquet's avatarMaxime “pep” Buquet <pep@collabora.com>
parent 5b0ce2b4
......@@ -498,6 +498,11 @@ export default {
display_name: t('admin.team.showUsername'),
display_name_default: 'Show username (default)',
},
{
value: Constants.TEAMMATE_NAME_DISPLAY.SHOW_NICKNAME_USERNAME,
display_name: t('admin.team.showNicknameOrUsername'),
display_name_default: 'Show nickname if one exists, otherwise show username',
},
{
value: Constants.TEAMMATE_NAME_DISPLAY.SHOW_NICKNAME_FULLNAME,
display_name: t('admin.team.showNickname'),
......
......@@ -204,6 +204,7 @@ export default class UserSettingsDisplay extends React.Component {
firstOption,
secondOption,
thirdOption,
fourthOption,
description,
} = props;
......@@ -257,6 +258,16 @@ export default class UserSettingsDisplay extends React.Component {
);
}
let fourthMessage;
if (fourthOption) {
fourthMessage = (
<FormattedMessage
id={fourthOption.radionButtonText.id}
defaultMessage={fourthOption.radionButtonText.message}
/>
);
}
const messageTitle = (
<FormattedMessage
id={title.id}
......@@ -272,13 +283,15 @@ export default class UserSettingsDisplay extends React.Component {
);
if (this.props.activeSection === section) {
const format = [false, false, false];
const format = [false, false, false, false];
if (value === firstOption.value) {
format[0] = true;
} else if (value === secondOption.value) {
format[1] = true;
} else {
} else if (thirdOption && value === thirdOption.value) {
format[2] = true;
} else {
format[3] = true;
}
const name = section + 'Format';
......@@ -295,6 +308,11 @@ export default class UserSettingsDisplay extends React.Component {
thirdDisplay[display] = thirdOption.value;
}
const fourthDisplay = {};
if (fourthOption) {
fourthDisplay[display] = fourthOption.value;
}
let thirdSection;
if (thirdMessage) {
thirdSection = (
......@@ -314,6 +332,25 @@ export default class UserSettingsDisplay extends React.Component {
);
}
let fourthSection;
if (fourthMessage) {
fourthSection = (
<div className='radio'>
<label>
<input
id={name + 'D'}
type='radio'
name={name}
checked={format[3]}
onChange={() => this.handleOnChange(fourthDisplay)}
/>
{fourthMessage}
</label>
<br/>
</div>
);
}
const inputs = [
<div key={key}>
<div className='radio'>
......@@ -347,6 +384,7 @@ export default class UserSettingsDisplay extends React.Component {
<br/>
</div>
{thirdSection}
{fourthSection}
<div>
<br/>
{messageDesc}
......@@ -517,6 +555,13 @@ export default class UserSettingsDisplay extends React.Component {
message: 'Show first and last name',
},
},
fourthOption: {
value: Constants.TEAMMATE_NAME_DISPLAY.SHOW_NICKNAME_USERNAME,
radionButtonText: {
id: 'user.settings.display.teammateNameDisplayNicknameUsername',
message: 'Show nickname if one exists, otherwise show username',
},
},
description: {
id: t('user.settings.display.teammateNameDisplayDescription'),
message: 'Set how to display other user\'s names in posts and the Direct Messages list.',
......
......@@ -1269,6 +1269,7 @@
"admin.team.restrictTitle": "Restrict account creation to specified email domains:",
"admin.team.showFullname": "Show first and last name",
"admin.team.showNickname": "Show nickname if one exists, otherwise show first and last name",
"admin.team.showNicknameOrUsername": "Show nickname if one exists, otherwise show username",
"admin.team.showUsername": "Show username (default)",
"admin.team.siteNameDescription": "Name of service shown in login screens and UI.",
"admin.team.siteNameExample": "E.g.: \"Mattermost\"",
......@@ -2744,6 +2745,7 @@
"user.settings.display.teammateNameDisplayDescription": "Set how to display other user's names in posts and the Direct Messages list.",
"user.settings.display.teammateNameDisplayFullname": "Show first and last name",
"user.settings.display.teammateNameDisplayNicknameFullname": "Show nickname if one exists, otherwise show first and last name",
"user.settings.display.teammateNameDisplayNicknameUsername": "Show nickname if one exists, otherwise show username",
"user.settings.display.teammateNameDisplayTitle": "Teammate Name Display",
"user.settings.display.teammateNameDisplayUsername": "Show username",
"user.settings.display.theme.applyToAllTeams": "Apply new theme to all my teams",
......
......@@ -2719,6 +2719,7 @@
"user.settings.display.teammateNameDisplayDescription": "Choisissez comment afficher les noms des autres utilisateurs dans les messages et la liste de messages personnels.",
"user.settings.display.teammateNameDisplayFullname": "Afficher le prénom d'abord puis le nom",
"user.settings.display.teammateNameDisplayNicknameFullname": "Afficher le pseudo s'il existe, sinon afficher le prénom d'abord puis le nom",
"user.settings.display.teammateNameDisplayNicknameUsername": "Afficher le pseudo s'il exists, sinon afficher le nom d'utilisateur",
"user.settings.display.teammateNameDisplayTitle": "Affichage des noms des membres de l'équipe",
"user.settings.display.teammateNameDisplayUsername": "Afficher le nom d'utilisateur",
"user.settings.display.theme.applyToAllTeams": "Appliquer le nouveau thème à toutes mes équipes",
......
......@@ -2719,6 +2719,7 @@
"user.settings.display.teammateNameDisplayDescription": "投稿やダイレクトメッセージ中の他のユーザーの名前の表示方法を設定します。",
"user.settings.display.teammateNameDisplayFullname": "氏名を表示する",
"user.settings.display.teammateNameDisplayNicknameFullname": "ニックネームがあればそれを表示する。無ければ氏名を表示する。",
"user.settings.display.teammateNameDisplayNicknameFullname": "ニックネームがあればそれを表示する。無ければユーザー名を表示する",
"user.settings.display.teammateNameDisplayTitle": "チームメイトの名前の表示",
"user.settings.display.teammateNameDisplayUsername": "ユーザー名を表示する",
"user.settings.display.theme.applyToAllTeams": "全ての自分のチームに新しいテーマを適用する",
......
......@@ -1299,6 +1299,7 @@ export const Constants = {
RHS_ROOT: 'rhsroot',
TEAMMATE_NAME_DISPLAY: {
SHOW_USERNAME: 'username',
SHOW_NICKNAME_USERNAME: 'nickname_username',
SHOW_NICKNAME_FULLNAME: 'nickname_full_name',
SHOW_FULLNAME: 'full_name',
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment