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

Replace modal store with redux view reducer #6784 #371

Merged
merged 16 commits into from
Dec 1, 2017

Conversation

mikelinden1
Copy link
Contributor

@mikelinden1 mikelinden1 commented Nov 28, 2017

Summary

Added Redux reducer to toggle modal state. Use ToggleModalButtonRedux instead of ToggleModalButton and provide a modalId prop (defined in constants->modalIdentifiers). There is a ModalController component in the NeedsTeam component that displays the modals.

Ticket Link

mattermost/mattermost#6784

Checklist

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

@mattermod
Copy link
Contributor

Thanks @mikelinden1 for the pull request!

Per the CONTRIBUTING.md file displayed when you created this pull request, we need to add you to the list of approved contributors for the Mattermost project.

Please help complete the Mattermost contribution license agreement?

This is a standard procedure for many open source projects. Your form should be processed within 24 hours and reviewers for your pull request will be able to proceed.

Please let us know if you have any questions.

We are very happy to have you join our growing community! If you're not yet a member, please consider joining our Contributors community channel to meet other contributors and discuss new opportunities with the core team.

@jwilander jwilander added the 2: Dev Review Requires review by a core commiter label Nov 28, 2017
@jwilander
Copy link
Member

@mikelinden1 you've got a few styling errors (which is causing the build to fail). You can see them locally by running make check-style

@mikelinden1
Copy link
Contributor Author

@jwilander Sorry about that! I ran check-style on the server repo by mistake. I just pushed the fixes.

Copy link
Member

@hmhealey hmhealey left a comment

Choose a reason for hiding this comment

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

Looks awesome aside from some nitpicking about import paths

The only thing I could see maybe changing is that passing in the modalId everywhere may be a bit redundant if every ToggleModalButtonRedux will take the exact same modalId for a given dialogType. If EditChannelHeaderModal, for example, is always passed in with ModalIdentifiers.EDIT_CHANNEL_HEADER, we could consider adding a static method/constant to each modal component that contains a string identifier that could be used by ToggleModalButtonRedux. Then, ToggleModalButtonRedux could do

const modalData = {
    modalId: dialogType.MODAL_ID, // where EditChannelHeaderModal.MODAL_ID = ModalIdentifiers.EDIT_CHANNEL_HEADER
    dialogProps,
    dialogType
};

this.props.actions.openModal(modalData);

That being said, that's just an idea since it may end up being better allowing modalId to be passed in separately since that does give us some options we wouldn't otherwise have.

Edit: Actually, that probably won't work due to connect or injectIntl potentially wrapping the modal component classes. Never mind then.

import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';

import {closeModal} from '../../actions/views/modals';
Copy link
Member

Choose a reason for hiding this comment

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

Can you change this to use an absolute path? We prefer to use those except in cases like below where you're importing the component into index.js

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem, I just pushed the change.


import ModalToggleButtonRedux from './toggle_modal_button_redux.jsx';

import {openModal, closeModal} from '../../actions/views/modals';
Copy link
Member

Choose a reason for hiding this comment

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

And here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ditto above.

@hmhealey hmhealey self-requested a review November 28, 2017 23:02
Copy link
Member

@hmhealey hmhealey 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
Contributor

@enahum enahum left a comment

Choose a reason for hiding this comment

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

LGTM

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, nice work! Just going to ask QA to give it a smoke test before we merge

@jwilander
Copy link
Member

@lindalumitchell would you be able to give this a test pass? It affects the opening/closing of the edit channel header, view channel info, channel notifications, channel invite and delete channel modals

@jwilander jwilander requested review from lindalumitchell and removed request for saturninoabril November 29, 2017 16:47
@jwilander jwilander added 1: PM Review Requires review by a product manager and removed 2: Dev Review Requires review by a core commiter labels Nov 29, 2017
@lindalumitchell lindalumitchell added the Setup Old Test Server Triggers the creation of a test server label Nov 29, 2017
@lindalumitchell
Copy link
Contributor

lindalumitchell commented Nov 29, 2017

@mikelinden1 @jwilander I've been testing a bit, and found one Javascript error:

  1. Channel name drop-down > Manage Members
  2. Click Add Members button

Observed: Add Members modal does not open, Javascript error displays
Expected: Add Members modal opens, no error

Note: There are some important elements I can't verify at the moment because they're broken on master:

Edit: Forgot screenshots:
screen shot 2017-11-29 at 11 01 59 am
screen shot 2017-11-29 at 11 01 40 am

@mikelinden1
Copy link
Contributor Author

Found the problem. Just had to pass the openDialog function as the showInviteModal prop to ChannelMembersModal. @lindalumitchell @jwilander

@mattermost mattermost deleted a comment from mattermod Nov 30, 2017
@lindalumitchell lindalumitchell removed the Setup Old Test Server Triggers the creation of a test server label Nov 30, 2017
@lindalumitchell
Copy link
Contributor

@mikelinden1 @jwilander Should I do another test pass at this point?

@jwilander
Copy link
Member

Yes please @lindalumitchell, if you can just confirm the one bug fix and we should be good. Thanks!

@lindalumitchell lindalumitchell added Setup Old Test Server Triggers the creation of a test server and removed Setup Old Test Server Triggers the creation of a test server labels Nov 30, 2017
@mattermost mattermost deleted a comment from mattermod Nov 30, 2017
@ccbrown ccbrown added Setup Old Test Server Triggers the creation of a test server and removed Setup Old Test Server Triggers the creation of a test server labels Nov 30, 2017
@mattermod
Copy link
Contributor

Setup Test Server label detected. Spinmint test server created if build succeeds (checks pass and no conflicts with base branch).

@mattermod
Copy link
Contributor

Spinmint test server created at: https://i-08ef1cc0053679432.spinmint.com

Test Account 1: Email: [email protected] | Password: passwd

Test Account 2: Email: [email protected] | Password: passwd

Instance ID: i-08ef1cc0053679432

@lindalumitchell
Copy link
Contributor

@mikelinden1 @jwilander I verified the issue has been fixed, and did a little bit of re-testing, and it looks good!

One caveat: I'm still unable to test Edit Header, Edit Purpose, and Rename Channel from the drop-down, because those are still broken on master. So it looks like we'll need to verify those after this PR is merged, once those issues are fixed.

@jwilander jwilander added 2: Dev Review Requires review by a core commiter and removed 1: PM Review Requires review by a product manager labels Nov 30, 2017
@jwilander
Copy link
Member

Thanks @lindalumitchell !

@saturninoabril if you're happy with the changes from your feedback, please approve and we can merge

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.

All looks good to me. Thanks!

@saturninoabril saturninoabril added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core commiter Setup Old Test Server Triggers the creation of a test server labels Dec 1, 2017
@mattermod
Copy link
Contributor

Spinmint test server destroyed

@saturninoabril saturninoabril merged commit 74a0968 into mattermost:master Dec 1, 2017
@lindalumitchell lindalumitchell added the Tests/Not Needed Does not require new release tests label Dec 5, 2017
@esethna esethna added Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation labels Dec 5, 2017
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
Development

Successfully merging this pull request may close these issues.

9 participants