Commit 2fe3e504 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 d902ba6b
...@@ -498,6 +498,11 @@ export default { ...@@ -498,6 +498,11 @@ export default {
display_name: t('admin.team.showUsername'), display_name: t('admin.team.showUsername'),
display_name_default: 'Show username (default)', 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, value: Constants.TEAMMATE_NAME_DISPLAY.SHOW_NICKNAME_FULLNAME,
display_name: t('admin.team.showNickname'), display_name: t('admin.team.showNickname'),
......
...@@ -204,6 +204,7 @@ export default class UserSettingsDisplay extends React.Component { ...@@ -204,6 +204,7 @@ export default class UserSettingsDisplay extends React.Component {
firstOption, firstOption,
secondOption, secondOption,
thirdOption, thirdOption,
fourthOption,
description, description,
} = props; } = props;
...@@ -257,6 +258,16 @@ export default class UserSettingsDisplay extends React.Component { ...@@ -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 = ( const messageTitle = (
<FormattedMessage <FormattedMessage
id={title.id} id={title.id}
...@@ -272,13 +283,15 @@ export default class UserSettingsDisplay extends React.Component { ...@@ -272,13 +283,15 @@ export default class UserSettingsDisplay extends React.Component {
); );
if (this.props.activeSection === section) { if (this.props.activeSection === section) {
const format = [false, false, false]; const format = [false, false, false, false];
if (value === firstOption.value) { if (value === firstOption.value) {
format[0] = true; format[0] = true;
} else if (value === secondOption.value) { } else if (value === secondOption.value) {
format[1] = true; format[1] = true;
} else { } else if (thirdOption && value === thirdOption.value) {
format[2] = true; format[2] = true;
} else {
format[3] = true;
} }
const name = section + 'Format'; const name = section + 'Format';
...@@ -295,6 +308,11 @@ export default class UserSettingsDisplay extends React.Component { ...@@ -295,6 +308,11 @@ export default class UserSettingsDisplay extends React.Component {
thirdDisplay[display] = thirdOption.value; thirdDisplay[display] = thirdOption.value;
} }
const fourthDisplay = {};
if (fourthOption) {
fourthDisplay[display] = fourthOption.value;
}
let thirdSection; let thirdSection;
if (thirdMessage) { if (thirdMessage) {
thirdSection = ( thirdSection = (
...@@ -314,6 +332,25 @@ export default class UserSettingsDisplay extends React.Component { ...@@ -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 = [ const inputs = [
<div key={key}> <div key={key}>
<div className='radio'> <div className='radio'>
...@@ -347,6 +384,7 @@ export default class UserSettingsDisplay extends React.Component { ...@@ -347,6 +384,7 @@ export default class UserSettingsDisplay extends React.Component {
<br/> <br/>
</div> </div>
{thirdSection} {thirdSection}
{fourthSection}
<div> <div>
<br/> <br/>
{messageDesc} {messageDesc}
...@@ -517,6 +555,13 @@ export default class UserSettingsDisplay extends React.Component { ...@@ -517,6 +555,13 @@ export default class UserSettingsDisplay extends React.Component {
message: 'Show first and last name', 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: { description: {
id: t('user.settings.display.teammateNameDisplayDescription'), id: t('user.settings.display.teammateNameDisplayDescription'),
message: 'Set how to display other user\'s names in posts and the Direct Messages list.', message: 'Set how to display other user\'s names in posts and the Direct Messages list.',
......
...@@ -1269,6 +1269,7 @@ ...@@ -1269,6 +1269,7 @@
"admin.team.restrictTitle": "Restrict account creation to specified email domains:", "admin.team.restrictTitle": "Restrict account creation to specified email domains:",
"admin.team.showFullname": "Show first and last name", "admin.team.showFullname": "Show first and last name",
"admin.team.showNickname": "Show nickname if one exists, otherwise 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.showUsername": "Show username (default)",
"admin.team.siteNameDescription": "Name of service shown in login screens and UI.", "admin.team.siteNameDescription": "Name of service shown in login screens and UI.",
"admin.team.siteNameExample": "E.g.: \"Mattermost\"", "admin.team.siteNameExample": "E.g.: \"Mattermost\"",
...@@ -2746,6 +2747,7 @@ ...@@ -2746,6 +2747,7 @@
"user.settings.display.teammateNameDisplayDescription": "Set how to display other user's names in posts and the Direct Messages list.", "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.teammateNameDisplayFullname": "Show first and last name",
"user.settings.display.teammateNameDisplayNicknameFullname": "Show nickname if one exists, otherwise 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.teammateNameDisplayTitle": "Teammate Name Display",
"user.settings.display.teammateNameDisplayUsername": "Show username", "user.settings.display.teammateNameDisplayUsername": "Show username",
"user.settings.display.theme.applyToAllTeams": "Apply new theme to all my teams", "user.settings.display.theme.applyToAllTeams": "Apply new theme to all my teams",
......
...@@ -2727,6 +2727,7 @@ ...@@ -2727,6 +2727,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.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.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.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.teammateNameDisplayTitle": "Affichage des noms des membres de l'équipe",
"user.settings.display.teammateNameDisplayUsername": "Afficher le nom d'utilisateur", "user.settings.display.teammateNameDisplayUsername": "Afficher le nom d'utilisateur",
"user.settings.display.theme.applyToAllTeams": "Appliquer le nouveau thème à toutes mes équipes", "user.settings.display.theme.applyToAllTeams": "Appliquer le nouveau thème à toutes mes équipes",
......
...@@ -2727,6 +2727,7 @@ ...@@ -2727,6 +2727,7 @@
"user.settings.display.teammateNameDisplayDescription": "投稿やダイレクトメッセージ中の他のユーザーの名前の表示方法を設定します。", "user.settings.display.teammateNameDisplayDescription": "投稿やダイレクトメッセージ中の他のユーザーの名前の表示方法を設定します。",
"user.settings.display.teammateNameDisplayFullname": "氏名を表示する", "user.settings.display.teammateNameDisplayFullname": "氏名を表示する",
"user.settings.display.teammateNameDisplayNicknameFullname": "ニックネームがあればそれを表示する。無ければ氏名を表示する。", "user.settings.display.teammateNameDisplayNicknameFullname": "ニックネームがあればそれを表示する。無ければ氏名を表示する。",
"user.settings.display.teammateNameDisplayNicknameFullname": "ニックネームがあればそれを表示する。無ければユーザー名を表示する",
"user.settings.display.teammateNameDisplayTitle": "チームメイトの名前の表示", "user.settings.display.teammateNameDisplayTitle": "チームメイトの名前の表示",
"user.settings.display.teammateNameDisplayUsername": "ユーザー名を表示する", "user.settings.display.teammateNameDisplayUsername": "ユーザー名を表示する",
"user.settings.display.theme.applyToAllTeams": "全ての自分のチームに新しいテーマを適用する", "user.settings.display.theme.applyToAllTeams": "全ての自分のチームに新しいテーマを適用する",
......
...@@ -1299,6 +1299,7 @@ export const Constants = { ...@@ -1299,6 +1299,7 @@ export const Constants = {
RHS_ROOT: 'rhsroot', RHS_ROOT: 'rhsroot',
TEAMMATE_NAME_DISPLAY: { TEAMMATE_NAME_DISPLAY: {
SHOW_USERNAME: 'username', SHOW_USERNAME: 'username',
SHOW_NICKNAME_USERNAME: 'nickname_username',
SHOW_NICKNAME_FULLNAME: 'nickname_full_name', SHOW_NICKNAME_FULLNAME: 'nickname_full_name',
SHOW_FULLNAME: '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