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

create fix for undefined substring call #324

Merged
merged 3 commits into from
Dec 21, 2017

Conversation

csduarte
Copy link
Contributor

@csduarte csduarte commented Nov 20, 2017

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.]

  • Ran make check-style to check for style errors (required for all pull requests)
  • Ran make test to ensure unit and component tests passed
  • Added or updated unit tests (required for all new features)
  • Has server changes (please link)
  • Has redux changes (please link)
  • Has UI changes
  • Includes text changes and localization file (.../i18n/en.json) updates
  • Touches critical sections of the codebase (auth, posting, etc.)

@dmeza

@jasonblais jasonblais added the 2: Dev Review Requires review by a core commiter label Nov 20, 2017
@@ -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) : '??';
Copy link
Member

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?

Copy link
Contributor

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

Copy link
Contributor

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?

Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor

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,

Copy link
Contributor

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.

@saturninoabril saturninoabril added the 1: PM Review Requires review by a product manager label Nov 21, 2017
@jasonblais jasonblais added the Setup Old Test Server Triggers the creation of a test server label Nov 21, 2017
@jasonblais jasonblais self-assigned this Nov 21, 2017
@jasonblais jasonblais added the Awaiting Submitter Action Blocked on the author label Nov 29, 2017
@dmeza
Copy link
Contributor

dmeza commented Dec 7, 2017

@jasonblais @saturninoabril rebased to the latest from master and added a Tooltip Name Undefined when Team displayName is null.

teambuttonundefined

Copy link
Contributor

@jasonblais jasonblais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PM approved

@jasonblais jasonblais removed 1: PM Review Requires review by a product manager Awaiting Submitter Action Blocked on the author Setup Old Test Server Triggers the creation of a test server labels Dec 7, 2017
@mattermost mattermost deleted a comment from mattermod Dec 7, 2017
@mattermost mattermost deleted a comment from mattermod Dec 7, 2017
@mattermost mattermost deleted a comment from mattermod Dec 7, 2017
@jasonblais jasonblais removed their assignment Dec 7, 2017
@@ -70,14 +70,15 @@ export default class TeamButton extends React.Component {
</div>
);
} else {
const toolTip = this.props.displayName ? this.props.tip : 'Name undefined';
Copy link
Member

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?

Copy link
Member

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';
Copy link
Member

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')

@dmeza
Copy link
Contributor

dmeza commented Dec 8, 2017

@saturninoabril rebased to latest from master and added localized message for Name undefined.

Copy link
Member

@saturninoabril saturninoabril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks!

Copy link
Member

@jwilander jwilander left a 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?

@jwilander jwilander removed the request for review from enahum December 13, 2017 16:59
@dmeza
Copy link
Contributor

dmeza commented Dec 13, 2017

@jwilander rebased to latest from master.

@dmeza
Copy link
Contributor

dmeza commented Dec 18, 2017

@jwilander rebased to latest from master.

@grundleborg grundleborg added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core commiter labels Dec 20, 2017
@jwilander jwilander merged commit e0457ee into mattermost:master Dec 21, 2017
@lindalumitchell lindalumitchell added the Tests/Not Needed Does not require new release tests label Dec 29, 2017
@jasonblais jasonblais added Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation labels Jan 4, 2018
dmeza pushed a commit to uber-archive/mattermost-webapp that referenced this pull request Jan 9, 2018
* create fix for undefined substring call

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

* Add localized message for `Name undefined`
dmeza pushed a commit to uber-archive/mattermost-webapp that referenced this pull request Jan 15, 2018
* create fix for undefined substring call

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

* Add localized message for `Name undefined`
dmeza pushed a commit to uber-archive/mattermost-webapp that referenced this pull request Jan 15, 2018
* create fix for undefined substring call

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

* Add localized message for `Name undefined`
@dmeza dmeza deleted the bash-2_undefined-call branch December 7, 2018 18:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4: Reviews Complete All reviewers have approved the pull request Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation Tests/Not Needed Does not require new release tests
Projects
None yet
9 participants