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

[MM-20550] Convert email notification setting to typescript #5199

Merged
merged 19 commits into from
Aug 31, 2020

Conversation

hiendinhngoc
Copy link
Contributor

Summary

Migrate 'components/user_settings/notifications/email_notification_setting' module and associated tests to TypeScript

Ticket Link

Fixes mattermost/mattermost#13691
JIRA: https://mattermost.atlassian.net/browse/MM-20550

@hiendinhngoc
Copy link
Contributor Author

I temporarily set enableEmailBatching to number type because getEmailInterval requires number type at the second argument. Please suggest the correct way to deal with enableEmailBatching

…tting' module and associated tests to TypeScript
@hanzei hanzei added the Work in Progress Not yet ready for review label Mar 26, 2020
@hanzei hanzei requested review from agnivade and devinbinnie and removed request for agnivade March 26, 2020 19:02
@hanzei
Copy link
Contributor

hanzei commented Mar 26, 2020

NVM @agnivade, GH played tricks on me

@hanzei
Copy link
Contributor

hanzei commented Mar 26, 2020

/update-branch

@devinbinnie
Copy link
Member

@hiendinhngoc Looks like the type on getEmailInterval is wrong, the parameter enableEmailBatching should be a boolean. I can make a fix for that, work under the assumption that it's a boolean. Sorry about that.

@devinbinnie
Copy link
Member

@devinbinnie
Copy link
Member

/update-branch

@devinbinnie
Copy link
Member

@hiendinhngoc The fix has been merged, and I've updated the branch for you.
There are some tests failing, which I've indicated below. Please make sure to git pull on your branch before making any changes.

Summary of all failing tests
 FAIL  components/user_settings/notifications/email_notification_setting/email_notification_setting.test.tsx
  ● components/user_settings/notifications/EmailNotificationSetting › should match snapshot

    expect(received).toMatchSnapshot()

    Snapshot name: `components/user_settings/notifications/EmailNotificationSetting should match snapshot 1`

    - Snapshot
    + Received

    @@ -6,11 +6,11 @@
        }
        activeSection="email"
        currentUserId="current_user_id"
        emailInterval={0}
        enableEmail={false}
    -   enableEmailBatching={0}
    +   enableEmailBatching={false}
        onCancel={[MockFunction]}
        onChange={[MockFunction]}
        onSubmit={[MockFunction]}
        saving={false}
        sendEmailNotifications={true}

      32 |         const wrapper = mountWithIntl(<EmailNotificationSetting {...requiredProps}/>);
      33 | 
    > 34 |         expect(wrapper).toMatchSnapshot();
         |                         ^
      35 |         expect(wrapper.find('#emailNotificationImmediately').exists()).toBe(true);
      36 |         expect(wrapper.find('#emailNotificationNever').exists()).toBe(true);
      37 |         expect(wrapper.find('#emailNotificationMinutes').exists()).toBe(false);

      at Object.test (components/user_settings/notifications/email_notification_setting/email_notification_setting.test.tsx:34:25)

  ● components/user_settings/notifications/EmailNotificationSetting › should match snapshot, enabled email batching

    expect(received).toMatchSnapshot()

    Snapshot name: `components/user_settings/notifications/EmailNotificationSetting should match snapshot, enabled email batching 1`

    - Snapshot
    + Received

    @@ -6,11 +6,11 @@
        }
        activeSection="email"
        currentUserId="current_user_id"
        emailInterval={0}
        enableEmail={false}
    -   enableEmailBatching={1}
    +   enableEmailBatching={true}
        onCancel={[MockFunction]}
        onChange={[MockFunction]}
        onSubmit={[MockFunction]}
        saving={false}
        sendEmailNotifications={true}

      46 |         const wrapper = mountWithIntl(<EmailNotificationSetting {...props}/>);
      47 | 
    > 48 |         expect(wrapper).toMatchSnapshot();
         |                         ^
      49 |         expect(wrapper.find('#emailNotificationMinutes').exists()).toBe(true);
      50 |         expect(wrapper.find('#emailNotificationHour').exists()).toBe(true);
      51 |     });

      at Object.test (components/user_settings/notifications/email_notification_setting/email_notification_setting.test.tsx:48:25)


Snapshot Summary
 › 2 snapshots failed from 1 test suite. Inspect your code changes or run `npm run test-ci -- -u` to update them.

@hiendinhngoc
Copy link
Contributor Author

@devinbinnie I updated, pls check

@devinbinnie devinbinnie removed the Work in Progress Not yet ready for review label Mar 31, 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 good overall, just a couple comments.

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.

Looking good now, thanks @hiendinhngoc!

@devinbinnie devinbinnie added 2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester labels Apr 27, 2020
@stylianosrigas stylianosrigas removed the Setup Cloud Test Server Setup a test server using Mattermost Cloud label Aug 26, 2020
@stylianosrigas
Copy link

Removing the test server for maintenance purposes. Please add the label again if you need it. Sorry for any inconvenience.

@devinbinnie devinbinnie added the Setup Cloud Test Server Setup a test server using Mattermost Cloud label Aug 26, 2020
@hiendinhngoc
Copy link
Contributor Author

@DHaussermann hi, I updated the code to fix the issue, please check it when you have time, thanks.

@DHaussermann DHaussermann added Setup Cloud Test Server Setup a test server using Mattermost Cloud and removed Setup Cloud Test Server Setup a test server using Mattermost Cloud labels Aug 31, 2020
@mm-cloud-bot mm-cloud-bot removed the Setup Cloud Test Server Setup a test server using Mattermost Cloud label Aug 31, 2020
@DHaussermann DHaussermann added the Setup Cloud Test Server Setup a test server using Mattermost Cloud label Aug 31, 2020
@DHaussermann DHaussermann added 2: Dev Review Requires review by a core commiter and removed Awaiting Submitter Action Blocked on the author Setup Cloud Test Server Setup a test server using Mattermost Cloud labels Aug 31, 2020
@devinbinnie devinbinnie added the Setup Cloud Test Server Setup a test server using Mattermost Cloud label Aug 31, 2020
Copy link

@DHaussermann DHaussermann left a comment

Choose a reason for hiding this comment

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

Tested and passed

  • Issue mentioned above is resolved
  • Briefly regression tested this product area
  • As a precaution I made sure the never / immediately setting still works as expected based on which option is selected
    LGTM!
    No need for any updates to release tests.

Re-requested a dev review for last commit. Will test again if there are any further changes needed.

Well done @hiendinhngoc! Huge thanks for your continued effort on this. Much appreciated.

@DHaussermann DHaussermann added QA Review Done and removed 3: QA Review Requires review by a QA tester labels Aug 31, 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.

Thanks @hiendinhngoc, this is working well now. Appreciate your dedication and hard work :)

@devinbinnie devinbinnie added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core commiter labels Aug 31, 2020
@devinbinnie devinbinnie merged commit b6d1332 into mattermost:master Aug 31, 2020
@mattermod mattermod removed the Setup Cloud Test Server Setup a test server using Mattermost Cloud label Aug 31, 2020
@mm-cloud-bot
Copy link

Test server destroyed

1 similar comment
@mm-cloud-bot
Copy link

Test server destroyed

@amyblais amyblais added Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation labels Sep 6, 2020
jfrerich pushed a commit that referenced this pull request Oct 23, 2020
* Convert email notification setting to ts

* Convert 'components/user_settings/notifications/email_notification_setting' module and associated tests to TypeScript

* Update enableEmailBatching type

* Update snapshots testing failure

* Minor update

* Update test cases, savePreferences' parameter type

* Minor update

* Remove unused variable

* Fix cannot change notification status(update enableEmail's type)

Co-authored-by: mattermod <[email protected]>
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 QA Review Done
Projects
None yet
9 participants