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

Redirect to New Workspace Creation with Invalid Policy Id in Workspace URL #4481

Merged
merged 3 commits into from
Aug 10, 2021

Conversation

mananjadhav
Copy link
Collaborator

@timszot Can you please review?

Details

  1. Added redirect to New Workspace page in case the URL contains invalid policy Id
  2. Moved navigation in workspace creation to next promise then block
  3. Added long duration to the error message

Fixed Issues

$ #4350

Tests

  1. Tested with invalid policyId in the URL (random numbers and characters)
  2. Tested with undefined in the URLs for Policy Id
  3. Tested New Workspace creation and then the redirection with this flow
  4. Verified existing workspace redirects are not impacted.

QA Steps

Tested On

  • Web
  • Mobile Web

Screenshots

Web

invalid-policyid-redirect-web.mp4

Mobile Web

invalid-policyid-redirect-mweb.mp4

@mananjadhav mananjadhav requested a review from a team as a code owner August 6, 2021 23:27
@MelvinBot MelvinBot requested review from timszot and removed request for a team August 6, 2021 23:27
@mananjadhav
Copy link
Collaborator Author

@timszot Work done. Few things with this PR.

  1. Need help with the message translations.
  2. I've added 2 fixes in workspace creation flow too - added .then block and successMessage translations
  3. Error duration is 3500ms, compared to regular 2000ms. Please let me know if 3500ms works.

@timszot
Copy link
Contributor

timszot commented Aug 9, 2021

Sorry for the delay here. I'll give this a review and work on getting the translations for you as well, but please give us some time as we're currently prioritising a company wide internal project.

@timszot timszot merged commit e1b046e into Expensify:main Aug 10, 2021
@TomatoToaster
Copy link
Contributor

Hey just a note for when this hits QA stage. We're getting rid of the Create Workspace page so these changes will be in effect slightly differently. We are making every instance where you'd see a modal to create a workspace instead just auto-create the workspace with a default name. So here, instead of seeing the modal when the policy in the link doesn't exist, one will just be auto created.

I'd say this doesn't need any further QA when it hits staging and instead the QA will be handled in the other PR where we're changing the Create Workspace behavior. Just making a note here so that not seeing a Create Workspace modal is NOT treated as a regression for this PR.

@mananjadhav
Copy link
Collaborator Author

@TomatoToaster Are you saying that with the other PR, my current PR's modal won't show. One workspace with the default name will be auto created and I don't need to handle it in the current PR, right?

@TomatoToaster
Copy link
Contributor

Yep you got it. Nothing left to do on your side 👍🏾

@isagoico
Copy link

@mananjadhav Hello! Any QA needed for this PR?

@mananjadhav
Copy link
Collaborator Author

@isagoico From QA, we could just check that it doesn't land up to a blank Workspace Card page?

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @timszot in version: 1.0.83-2 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 failure ❌
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@botify
Copy link

botify commented Aug 17, 2021

This has been deployed to production and is now subject to a 7-day regression period.
If no regressions arise, payment will be issued on 2021-08-24. 🎊

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @isagoico in version: 1.0.85-9 🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

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

Noticed a bug on dev related to this PR, but unsure if it's causing any significant issues. What I observed was a failure to create a policy and then the app crashes. Unfortunately, I didn't manage to catch why the policy wasn't created.

Gonna create an issue to make sure we handle this case properly.

Navigation.dismissModal();
Navigation.navigate(ROUTES.getWorkspaceCardRoute(response.policyID));
Navigation.navigate(ROUTES.getWorkspaceCardRoute(res.policyID));
Copy link
Contributor

Choose a reason for hiding this comment

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

Heads up, res will be null if we get a non 200 jsonCode here. Since we are returning early in the first .then() block the next once will still go and we end up trying to access policyID on null.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay. Give me a day I'll check. Afaik, Workspace creation was manual with the form when this PR was merged and we did test this.

I'll fix it anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@TomatoToaster Does your change cover this as well? or I'll cover this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh hey, I totally did not do this, my bad for missing this comment! I put up a PR here: #5687

if (_.isEmpty(policy)) {
return null;
}
useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay. I'll check and update.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll mostly be working on this issue #5185 and it involves working on WorkspaceSidebar. I'll update this block of code too when working with this PR.

Will change WorkspaceSidebar to a class component.

Copy link
Contributor

@TomatoToaster TomatoToaster Sep 21, 2021

Choose a reason for hiding this comment

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

Hey just want to note, I actually got rid of the useEffect in one of my PRs when I was editing this component. You won't need to update it!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@TomatoToaster Thanks for the note. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants