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

Conversation

sridhar02
Copy link
Contributor

@sridhar02 sridhar02 commented Jul 24, 2020

Summary

  • Migrate 'components/user_settings/display' module and associated tests to TypeScript
  • Rename the files to their associated TypeScript extensions (ie. js to ts, jsx to tsx)
  • Update any components using those to the correct imports
  • Fix any errors generated by the TypeScript compiler. You can run make check-types to display any errors.

Ticket Link

Fixes mattermost/mattermost#13696

JIRA Ticket https://mattermost.atlassian.net/browse/MM-20545

@sridhar02 sridhar02 changed the title Mm 20545 migrate components/user settings/display to type script MM 20545 migrate components/user settings/display to type script Jul 24, 2020
@hanzei hanzei requested a review from devinbinnie July 24, 2020 11:07
@hanzei hanzei added 2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester labels Jul 24, 2020
@devinbinnie devinbinnie added the Work in Progress Not yet ready for review label Jul 24, 2020
@sridhar02 sridhar02 force-pushed the MM-20545-Migrate-components/user_settings/display-to-TypeScript branch 2 times, most recently from 9d13a02 to 3df8547 Compare July 29, 2020 06:52
@mattermost mattermost deleted a comment from devinbinnie Jul 29, 2020
@mattermost mattermost deleted a comment from sridhar02 Jul 29, 2020
@mattermost mattermost deleted a comment from devinbinnie Jul 29, 2020
@mattermost mattermost deleted a comment from sridhar02 Jul 29, 2020
@sridhar02 sridhar02 force-pushed the MM-20545-Migrate-components/user_settings/display-to-TypeScript branch from 3df8547 to 255e4fb Compare July 30, 2020 12:48
@devinbinnie devinbinnie removed the Work in Progress Not yet ready for review label Jul 30, 2020
Copy link
Member

@devinbinnie devinbinnie left a comment

Choose a reason for hiding this comment

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

Looks really good @sridhar02, thanks for your work on this :)

I have a few comments for you to review.

components/user_settings/display/index.ts Show resolved Hide resolved
components/user_settings/display/index.ts Outdated Show resolved Hide resolved
components/user_settings/display/user_settings_display.tsx Outdated Show resolved Hide resolved
components/user_settings/display/user_settings_display.tsx Outdated Show resolved Hide resolved
components/user_settings/display/user_settings_display.tsx Outdated Show resolved Hide resolved
@sridhar02 sridhar02 force-pushed the MM-20545-Migrate-components/user_settings/display-to-TypeScript branch from 255e4fb to 26fd695 Compare August 3, 2020 04:42
Copy link
Member

@devinbinnie devinbinnie left a comment

Choose a reason for hiding this comment

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

One quick little fix to make, thanks for your work :)

components/user_settings/display/user_settings_display.tsx Outdated Show resolved Hide resolved
@sridhar02 sridhar02 force-pushed the MM-20545-Migrate-components/user_settings/display-to-TypeScript branch 2 times, most recently from 55add01 to 023df8d Compare August 6, 2020 14:56
Copy link
Member

@devinbinnie devinbinnie left a comment

Choose a reason for hiding this comment

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

Almost there!

components/user_settings/display/user_settings_display.tsx Outdated Show resolved Hide resolved
Copy link
Member

@devinbinnie devinbinnie left a comment

Choose a reason for hiding this comment

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

Looks good now, thanks @sridhar02!

@sridhar02 sridhar02 force-pushed the MM-20545-Migrate-components/user_settings/display-to-TypeScript branch from 327f8ca to 3d521c0 Compare August 10, 2020 04:28
@saturninoabril
Copy link
Member

saturninoabril commented Aug 10, 2020

Hello @sridhar02 thanks for your contribution! I ran Cypress tests against this PR and it's failing to some user settings cases and looked like related to the changes here. Note that it's not failing on master. See https://mm-cypress-report.s3.amazonaws.com/709-webapp-pr-5988-327f8ca/mochawesome.html for reference. Could you please take a look at the failing tests? Let me know if you need help.

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

@devinbinnie devinbinnie removed the 2: Dev Review Requires review by a core commiter label Aug 10, 2020
@sridhar02 sridhar02 force-pushed the MM-20545-Migrate-components/user_settings/display-to-TypeScript branch from 3d521c0 to 5f7bb66 Compare August 13, 2020 11:05
@sridhar02 sridhar02 force-pushed the MM-20545-Migrate-components/user_settings/display-to-TypeScript branch from 5f7bb66 to b14043e Compare August 17, 2020 09:43
@sridhar02
Copy link
Contributor Author

@devinbinnie can you help me here, while verifying the cypress test failing , i found that unit tests are also failing in two places is user_setting_display.tsx file, in which userAutomaticTimezone is one of them, observed that it is boolean used for the input element attribute which always a boolean but in redux it defined like this, I think I need to change the redux type which will solve the error here what are your thoughts?

export type UserTimezone = {
    useAutomaticTimezone: boolean | string;
    automaticTimezone: string;
    manualTimezone: string;
};

https://github.com/mattermost/mattermost-redux/blob/d465f41cf007b05e95b7d2a83d1234561a87afe4/src/types/users.ts#L76

@devinbinnie
Copy link
Member

@devinbinnie can you help me here, while verifying the cypress test failing , i found that unit tests are also failing in two places is user_setting_display.tsx file, in which userAutomaticTimezone is one of them, observed that it is boolean used for the input element attribute which always a boolean but in redux it defined like this, I think I need to change the redux type which will solve the error here what are your thoughts?

export type UserTimezone = {
    useAutomaticTimezone: boolean | string;
    automaticTimezone: string;
    manualTimezone: string;
};

https://github.com/mattermost/mattermost-redux/blob/d465f41cf007b05e95b7d2a83d1234561a87afe4/src/types/users.ts#L76

@sridhar02 I think the string | boolean type is being used because our server is sending down the value as a string but our app only treats it as a boolean. There's a bit more at play here.

I think for your case, we can just force the type to be a boolean by wrapping it in a Boolean().

@sridhar02
Copy link
Contributor Author

@saturninoabril @devinbinnie I have fixed all the errors and cypress tests are also rectified, can you review the PR?

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.

Thanks @sridhar02! Tested and passed.

@saturninoabril saturninoabril added 4: Reviews Complete All reviewers have approved the pull request and removed 3: QA Review Requires review by a QA tester labels Aug 18, 2020
@saturninoabril saturninoabril added this to the v5.28 milestone Aug 18, 2020
@saturninoabril saturninoabril merged commit f4c21aa into mattermost:master Aug 18, 2020
@amyblais amyblais added Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation labels Aug 18, 2020
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
Projects
None yet
6 participants