Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
create fix for undefined substring call (#324)
Browse files Browse the repository at this point in the history
* create fix for undefined substring call

* Add Tooltip `Name Undefined` when Team displayName is null.

* Add localized message for `Name undefined`
  • Loading branch information
csduarte authored and jwilander committed Dec 21, 2017
1 parent 18a3073 commit e0457ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions components/team_sidebar/components/team_button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {switchTeams} from 'actions/team_actions.jsx';
import Constants from 'utils/constants.jsx';
import {isDesktopApp} from 'utils/user_agent.jsx';

import {localizeMessage} from 'utils/utils.jsx';

export default class TeamButton extends React.Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -51,7 +53,7 @@ export default class TeamButton extends React.Component {
let initials = this.props.displayName;
let content = this.props.content;
if (!content) {
initials = initials.replace(/\s/g, '').substring(0, 2);
initials = initials ? initials.replace(/\s/g, '').substring(0, 2) : '??';

content = (
<div className='team-btn__initials'>
Expand All @@ -70,14 +72,15 @@ export default class TeamButton extends React.Component {
</div>
);
} else {
const toolTip = this.props.displayName ? this.props.tip : localizeMessage('team.button.name_undefined', 'Name undefined');
btn = (
<OverlayTrigger
trigger={['hover', 'focus']}
delayShow={Constants.OVERLAY_TIME_DELAY}
placement={this.props.placement}
overlay={
<Tooltip id={`tooltip-${this.props.url}`}>
{this.props.tip}
{toolTip}
</Tooltip>
}
>
Expand Down
1 change: 1 addition & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2517,6 +2517,7 @@
"system_users_list.count": "{count, number} {count, plural, one {user} other {users}}",
"system_users_list.countPage": "{startCount, number} - {endCount, number} {count, plural, one {user} other {users}} of {total, number} total",
"system_users_list.countSearch": "{count, number} {count, plural, one {user} other {users}} of {total, number} total",
"team.button.name_undefined": "Name undefined",
"team_export_tab.download": "download",
"team_export_tab.export": "Export",
"team_export_tab.exportTeam": "Export your team",
Expand Down

0 comments on commit e0457ee

Please sign in to comment.