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

Implement Archived Workspace Chat UI #7831

Merged
merged 52 commits into from
Mar 24, 2022
Merged

Implement Archived Workspace Chat UI #7831

merged 52 commits into from
Mar 24, 2022

Conversation

roryabraham
Copy link
Contributor

@roryabraham roryabraham commented Feb 19, 2022

Details

Implements the Archived Workspace Chat UI.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/195474

Tests

Storybook

  1. Run storybook, verify that you can see the new stories for the Banner component.

    image image

    There are a number of issues with Storybook at present, none having to do with this PR or the new stories.

Setup

  1. Create and validate 5 accounts – 1 policy admin and 4 employees.
  2. Sign in as the policy admin in NewDot.
  3. Create a new workspace.
  4. Go to Settings > <Your workspace> > Manage members and invite all four employees to the workspace.

Account Closed

  1. Open the workspace chat for employee A. Verify that it's in the open state.

    • BUG: I had to sign out and sign back in for the workspace chat(s) to appear.

      image
  2. Sign into OldDot as employee A. Go to Settings > Account > Account Details and close the account.

    image
  3. Go back to NewDot. Verify that the workspace chat for employee is archived, and that you see the following:

    image
    • BUG: I had to refresh the page for the UI to update.
  4. Go back to the workspace chat for the employee w/ the closed account, and verify that you see the following:

    image

Account Merged

  1. Sign in to NewDot as employee B.

  2. Go to Settings > Profile and set a first and last name

  3. Sign in to NewDot as employee C.

  4. Go to Settings > Profile and set a first and last name

  5. Sign in to NewDot as the admin and find the workspace chat for employee C.

    image
  6. Sign in to OldDot as employee B.

  7. Go to Settings > Account > Account Details and merge employee C's account into employee B's account.

    image
  8. Go back to NewDot and employee C's workspace chat should now look like this:

    image
  9. Go to NewDot Settings > Preferences and switch the language to Spanish.

  10. Go back to the workspace chat for employee C and you should see the following copy:

image

Removed from Policy

Testing blocked on https://github.com/Expensify/Auth/pull/6456

Policy Deleted

Testing blocked on https://github.com/Expensify/Auth/pull/6456

  • Verify that no errors appear in the JS console

QA Steps

Most of this will be tested internally before we add a large suite of regressions to cover workspace chats. However, there is something that needs to be QA'd here (Chrome web only) to prevent performance regressions.

  1. Sign out.

  2. Open the JS console. Make sure you have verbose logs enabled. This dropdown should say All Levels:

    image
  3. Sign into a high traffic account with very large policies.

  4. Search the logs for Timing:expensify.cash.personal_details_formatted

  5. Verify that the number is very low (ideally less than 1000ms).

  6. Repeat these same steps on production with the same account, and post the difference in timing between staging and production in this PR.

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

All of the screenshots for the above steps were taken on web.

Mobile Web

image

image

Desktop

image

image

iOS

image

image

Android

@roryabraham roryabraham self-assigned this Feb 19, 2022
@@ -1329,6 +1320,15 @@ const styles = {
minHeight: variables.componentSizeNormal,
},

chatFooter: {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the same as chatItemCompose, just renamed. I just moved it so that it wasn't in between a number of other chatItem* styles.

src/CONST/index.js Outdated Show resolved Hide resolved
@roryabraham
Copy link
Contributor Author

Updated. @TomatoToaster let me know if this is what you had in mind, not sure i completely understood your last comment.

@roryabraham roryabraham changed the title [WIP] Create report action const for ARCHIVE_REASON report action [WIP] Implement Archived Chat Room UI Feb 24, 2022
src/CONST/index.js Outdated Show resolved Hide resolved
# Conflicts:
#	src/pages/home/report/ReportActionCompose.js
@roryabraham roryabraham marked this pull request as ready for review March 23, 2022 05:04
@roryabraham roryabraham requested a review from a team as a code owner March 23, 2022 05:04
@melvin-bot melvin-bot bot requested review from timszot and removed request for a team March 23, 2022 05:04
@roryabraham
Copy link
Contributor Author

roryabraham commented Mar 23, 2022

This is ready for review. The welcome messages are still weird for archived workspace chats but I'd prefer to handle that in a follow-up if that's okay with everyone. Created an issue here: #8272

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.

Looks great - had a few ideas for improvement.

src/components/ArchivedReportFooter.js Outdated Show resolved Hide resolved
src/components/ArchivedReportFooter.js Outdated Show resolved Hide resolved
src/components/ArchivedReportFooter.js Show resolved Hide resolved
src/components/Banner.js Show resolved Hide resolved
src/libs/LoginUtils.js Show resolved Hide resolved
src/libs/ValidationUtils.js Show resolved Hide resolved
@@ -87,20 +88,20 @@ function formatPersonalDetails(personalDetailsList) {

// This method needs to be SUPER PERFORMANT because it can be called with a massive list of logins depending on the policies that someone belongs to
// eslint-disable-next-line rulesdir/prefer-underscore-method
Object.keys(personalDetailsList).forEach((login) => {
const personalDetailsResponse = personalDetailsList[login];
Object.entries(personalDetailsList).forEach(([login, details]) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

The terrifying comment above this line seems to imply that Object.keys() + forEach() is more performant than underscore. I can't really think of why that would be, but at the same time my default is to trust whoever wrote it.

Since we are changing this to Object.entries() is there some way we can verify there are no performance regressions. Maybe testing against production with an account that will have many personal details (someone who has been at Expensify for a while perhaps)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we are changing this to Object.entries() is there some way we can verify there are no performance regressions. Maybe testing against production with an account that will have many personal details (someone who has been at Expensify for a while perhaps)?

Yes, I can add QA steps here.

FWIW here is the PR that introduced that, and the problem with the code before wasn't necessarily that we were using underscore instead of vanilla JS, just that we were using the spread operator in a reduce, which is an O(n^2) operation because it copies the whole object for every iteration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So it would probably be safe to just use _.each(personalDetailsList, (details, login) => {...}) because it doesn't have that spread inside a reduce.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added QA steps. Applause has access to some high-volume accounts with large policies (Expensify.org policies I think) that will give them thousands of personalDetails.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A bit of extra context here: #7649 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok cool. It's a weird comment then and sounds like we could update this to use underscore, but NAB.

src/libs/reportUtils.js Show resolved Hide resolved
src/pages/home/report/ReportActionCompose.js Show resolved Hide resolved
src/stories/Banner.stories.js Show resolved Hide resolved
@roryabraham roryabraham changed the title [No QA] Implement Archived Workspace Chat UI Implement Archived Workspace Chat UI Mar 23, 2022
/>
</View>
{
props.shouldRenderHTML
Copy link
Contributor

Choose a reason for hiding this comment

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

NAB, alternatively just always render HTML because plain text run through an HTML renderer is just text anyway

@@ -87,20 +88,20 @@ function formatPersonalDetails(personalDetailsList) {

// This method needs to be SUPER PERFORMANT because it can be called with a massive list of logins depending on the policies that someone belongs to
// eslint-disable-next-line rulesdir/prefer-underscore-method
Object.keys(personalDetailsList).forEach((login) => {
const personalDetailsResponse = personalDetailsList[login];
Object.entries(personalDetailsList).forEach(([login, details]) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok cool. It's a weird comment then and sounds like we could update this to use underscore, but NAB.

@TomatoToaster
Copy link
Contributor

I think we can merge this because the remaining NAB is minor. We can open a separate PR if we want to remove the renderHTML and test it works the same on all platforms.

@TomatoToaster TomatoToaster merged commit eb3b18e into main Mar 24, 2022
@TomatoToaster TomatoToaster deleted the Rory-ArchiveUI branch March 24, 2022 03:49
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @TomatoToaster in version: 1.1.46-0 🚀

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

@mvtglobally
Copy link

@roryabraham We are seeing the following numbers in Console. Response is missing time variant. Let us know if this looks good
Screenshot (262)

@roryabraham
Copy link
Contributor Author

Thanks. That's in ms so I think this is performant enough to be a QA-pass

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @timszot in version: 1.1.46-3 🚀

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

@puneetlath
Copy link
Contributor

@roryabraham @marcaaron FYI I believe this PR caused this bug: #13452

@puneetlath
Copy link
Contributor

Actually nvm. I think it was this PR actually: #11363

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