Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MM-20796] Un-reverted the Ctrl+Tab fix and also made sure the tabs go in the right order #1173

Merged
merged 4 commits into from
Jan 29, 2020

Conversation

devinbinnie
Copy link
Member

Before submitting, please confirm you've

Please provide the following information:

Summary
The fix in this PR: #1127
Was overwritten by this PR: #1056
This PR puts the fix back.

Also found a bug where tabbing through when you've re-ordered the tabs would tab through in the wrong order, also fixed.

Issue link
https://mattermost.atlassian.net/browse/MM-20796

@devinbinnie devinbinnie added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels Jan 29, 2020
@devinbinnie devinbinnie added this to the v4.4.0 milestone Jan 29, 2020
Copy link

@lindy65 lindy65 left a comment

Choose a reason for hiding this comment

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

Thanks @devinbinnie - I'll test this on the next RC

@lindy65 lindy65 added QA Review Done and removed 3: QA Review Requires review by a QA tester labels Jan 29, 2020
@amyblais amyblais added the CherryPick/Approved Meant for the quality or patch release tracked in the milestone label Jan 29, 2020
const nextIndex = this.props.teams.map((team, index) => {
return {
index,
order: (team.order - currentOrder) - 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

logic here can be made more readable if we swap the parens

Suggested change
order: (team.order - currentOrder) - 1,
order: team.order - (currentOrder + 1),

which looks more like "next tab"

src/browser/components/MainPage.jsx Outdated Show resolved Hide resolved
Comment on lines 169 to 176
const currentOrder = this.props.teams[this.state.key].order;
const nextIndex = this.props.teams.map((team, index) => {
return {
index,
order: (team.order - currentOrder) + 1,
};
}).find((team) => team.order === 0 || Math.abs(team.order) === this.props.teams.length);
this.handleSelect(nextIndex.index);
Copy link
Contributor

Choose a reason for hiding this comment

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

same comments as above, but going back ;)

@@ -335,7 +335,7 @@ export default class MattermostView extends React.Component {
if (this.props.withTab) {
classNames.push('mattermostView-with-tab');
}
if (!this.props.active || this.state.errorInfo) {
if (!this.props.active) {
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure of why this change is here :/ seems unrelated to the PR, can you help me understand?

Copy link
Member Author

Choose a reason for hiding this comment

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

See this PR: #1127

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks!

@@ -335,7 +335,7 @@ export default class MattermostView extends React.Component {
if (this.props.withTab) {
classNames.push('mattermostView-with-tab');
}
if (!this.props.active || this.state.errorInfo) {
if (!this.props.active) {
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks!

src/browser/components/MainPage.jsx Outdated Show resolved Hide resolved
src/browser/components/MainPage.jsx Outdated Show resolved Hide resolved
src/browser/components/MainPage.jsx Outdated Show resolved Hide resolved
Co-Authored-By: Guillermo Vayá <guivaya@gmail.com>
@Willyfrog
Copy link
Contributor

gah! hit the button too soon, there is an alternate implementation:

    ipcRenderer.on('select-next-tab', () => {
      const currentOrder = this.props.teams[this.state.key].order;
      const nextOrder = ((currentOrder + 1) % this.props.teams.length);
      const nextIndex = this.props.teams.findIndex((team) => team.order === nextOrder);
      this.handleSelect(nextIndex);
    });

    ipcRenderer.on('select-previous-tab', () => {
      const currentOrder = this.props.teams[this.state.key].order;

      // js modulo operator returns a negative number if result is negative, so we have to ensure it's positive
      const nextOrder = ((this.props.teams.length + (currentOrder - 1)) % this.props.teams.length);
      const nextIndex = this.props.teams.findIndex((team) => team.order === nextOrder);
      this.handleSelect(nextIndex);
    });

@Willyfrog Willyfrog added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core committer labels Jan 29, 2020
@devinbinnie devinbinnie merged commit 6551483 into mattermost:master Jan 29, 2020
@devinbinnie devinbinnie deleted the MM-20796 branch January 29, 2020 23:02
@mattermod
Copy link
Contributor

@devinbinnie
Error trying doing the automated Cherry picking. Please do this manually


devinbinnie added a commit to devinbinnie/desktop that referenced this pull request Jan 29, 2020
…o in the right order (mattermost#1173)

* [MM-20796] Un-reverted the Ctrl+Tab fix and also made sure the tabs go in the right order

* Style fixes

* Update src/browser/components/MainPage.jsx

Co-Authored-By: Guillermo Vayá <guivaya@gmail.com>

* Different logic

Co-authored-by: Guillermo Vayá <guivaya@gmail.com>
@devinbinnie devinbinnie added CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone and removed CherryPick/Approved Meant for the quality or patch release tracked in the milestone labels Jan 29, 2020
devinbinnie added a commit that referenced this pull request Jan 29, 2020
…o in the right order (#1173) (#1175)

* [MM-20796] Un-reverted the Ctrl+Tab fix and also made sure the tabs go in the right order

* Style fixes

* Update src/browser/components/MainPage.jsx

Co-Authored-By: Guillermo Vayá <guivaya@gmail.com>

* Different logic

Co-authored-by: Guillermo Vayá <guivaya@gmail.com>

Co-authored-by: Guillermo Vayá <guivaya@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone QA Review Done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants