-
Notifications
You must be signed in to change notification settings - Fork 2.7k
create fix for undefined substring call #324
create fix for undefined substring call #324
Conversation
@@ -49,10 +49,11 @@ export default class TeamButton extends React.Component { | |||
|
|||
let btn; | |||
let content = this.props.content; | |||
const shortName = this.props.displayName ? this.props.displayName.substring(0, 2) : '??'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me except for the use of ??
.
@jasonblais Could you please validate ??
if we could use this convention whenever displayName is undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this feels weird, if the displayName is not set I would use the name of the team, I don't think ??
will do the job at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saturninoabril @enahum How do I validate this? Do I need to test the team icons in the sidebar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes the text displayed in the team icon should never be ??
as that does not tell me what team is it, and apart from that what I'm seeing is that if somehow the displayName
is not set it will not only set the name as ??
but the tooltip will also be empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmeza Which issue is this PR resolving?
I was trying to test the fix on the test server, and it seems to work fine, but I'm not sure if I have the correct repro steps since I'm unable to create a team without a display name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I have not seen that happened to team display name (being null). Maybe, the first thing is to request from @dmeza about the repro steps on how he observed null displayName
being passed to TeamButton
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this seems odd, we thought so at the time, but it is possible. By looking at code we could not figure out why, debugging was hard. It completely killed production at one point during launch. So it's best we just guard against this knowing it's not a likely case, but is possible.
Again, we didn't do the ?? for style, we did it because the web app would not load without fixing this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! The context is useful, have queued for review by our design team.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmeza Waiting on design team's feedback -- just curious if it's easy to set a non-empty tooltip for this case like Name undefined
? Just want to gauge the level of effort,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmeza The ??
should be okay in the team icon. I'm not sure what else would be better instead. It would be nice if there was a tooltip in that case with text Name undefined
, but depends on level of effort for adding it.
a946edb
to
b8a9420
Compare
b8a9420
to
f4a0f58
Compare
@jasonblais @saturninoabril rebased to the latest from master and added a Tooltip |
f4a0f58
to
300c56d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PM approved
@@ -70,14 +70,15 @@ export default class TeamButton extends React.Component { | |||
</div> | |||
); | |||
} else { | |||
const toolTip = this.props.displayName ? this.props.tip : 'Name undefined'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jasonblais Should Name undefined
be localized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmeza All looks good to me except for a minor request to have this localized
localizeMessage('team.button.name_undefined', 'Name undefined')
@@ -70,14 +70,15 @@ export default class TeamButton extends React.Component { | |||
</div> | |||
); | |||
} else { | |||
const toolTip = this.props.displayName ? this.props.tip : 'Name undefined'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmeza All looks good to me except for a minor request to have this localized
localizeMessage('team.button.name_undefined', 'Name undefined')
300c56d
to
2c61262
Compare
@saturninoabril rebased to latest from master and added localized message for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, could you just give this one final rebase and we can merge?
2c61262
to
399e06e
Compare
@jwilander rebased to latest from master. |
399e06e
to
62bdf75
Compare
@jwilander rebased to latest from master. |
* create fix for undefined substring call * Add Tooltip `Name Undefined` when Team displayName is null. * Add localized message for `Name undefined`
* create fix for undefined substring call * Add Tooltip `Name Undefined` when Team displayName is null. * Add localized message for `Name undefined`
* create fix for undefined substring call * Add Tooltip `Name Undefined` when Team displayName is null. * Add localized message for `Name undefined`
Summary
Adds a fix for an undefined method call for the team button in the team sidebar.
Checklist
[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]
make check-style
to check for style errors (required for all pull requests)make test
to ensure unit and component tests passed@dmeza