From a08d870abb49d39856a874f8b092db1379e75fc3 Mon Sep 17 00:00:00 2001 From: Abdul Rahuman Date: Thu, 4 May 2023 09:57:33 +0530 Subject: [PATCH] Followup fixes on invite message page implementation --- .../workspace/WorkspaceInviteMessagePage.js | 9 +++++++- src/pages/workspace/WorkspaceInvitePage.js | 21 ++++++++----------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/pages/workspace/WorkspaceInviteMessagePage.js b/src/pages/workspace/WorkspaceInviteMessagePage.js index f91da6c12a8d..349aa0d8a195 100644 --- a/src/pages/workspace/WorkspaceInviteMessagePage.js +++ b/src/pages/workspace/WorkspaceInviteMessagePage.js @@ -42,6 +42,9 @@ const propTypes = { /** All of the personal details for everyone */ personalDetails: PropTypes.objectOf(personalDetailsPropTypes), + /** Beta features list */ + betas: PropTypes.arrayOf(PropTypes.string), + invitedMembersDraft: PropTypes.arrayOf(PropTypes.string), /** URL Route params */ @@ -60,6 +63,7 @@ const propTypes = { const defaultProps = { ...policyDefaultProps, personalDetails: {}, + betas: [], invitedMembersDraft: [], }; @@ -109,7 +113,7 @@ class WorkspaceInviteMessagePage extends React.Component { } sendInvitation() { - Policy.addMembersToWorkspace(this.props.invitedMembersDraft, this.state.welcomeNote || this.getWelcomeNote(), this.props.route.params.policyID); + Policy.addMembersToWorkspace(this.props.invitedMembersDraft, this.state.welcomeNote || this.getWelcomeNote(), this.props.route.params.policyID, this.props.betas); Policy.setWorkspaceInviteMembersDraft(this.props.route.params.policyID, []); Navigation.navigate(ROUTES.getWorkspaceMembersRoute(this.props.route.params.policyID)); } @@ -221,6 +225,9 @@ export default compose( personalDetails: { key: ONYXKEYS.PERSONAL_DETAILS, }, + betas: { + key: ONYXKEYS.BETAS, + }, invitedMembersDraft: { key: ({route}) => `${ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${route.params.policyID.toString()}`, }, diff --git a/src/pages/workspace/WorkspaceInvitePage.js b/src/pages/workspace/WorkspaceInvitePage.js index 8aff82ffb281..8881c8bf2ca2 100644 --- a/src/pages/workspace/WorkspaceInvitePage.js +++ b/src/pages/workspace/WorkspaceInvitePage.js @@ -89,7 +89,6 @@ class WorkspaceInvitePage extends React.Component { personalDetails, selectedOptions: [], userToInvite, - shouldDisableButton: false, }; } @@ -247,16 +246,14 @@ class WorkspaceInvitePage extends React.Component { return; } - this.setState({shouldDisableButton: true}, () => { - const logins = _.map(this.state.selectedOptions, option => option.login); - const filteredLogins = _.chain(logins) - .map(login => login.toLowerCase().trim()) - .compact() - .uniq() - .value(); - Policy.setWorkspaceInviteMembersDraft(this.props.route.params.policyID, filteredLogins); - Navigation.navigate(ROUTES.getWorkspaceInviteMessageRoute(this.props.route.params.policyID)); - }); + const logins = _.map(this.state.selectedOptions, option => option.login); + const filteredLogins = _.chain(logins) + .map(login => login.toLowerCase().trim()) + .compact() + .uniq() + .value(); + Policy.setWorkspaceInviteMembersDraft(this.props.route.params.policyID, filteredLogins); + Navigation.navigate(ROUTES.getWorkspaceInviteMessageRoute(this.props.route.params.policyID)); } /** @@ -321,7 +318,7 @@ class WorkspaceInvitePage extends React.Component {