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

[Group Chats] Add remaining features #39757

Merged
merged 98 commits into from
Apr 12, 2024
Merged

[Group Chats] Add remaining features #39757

merged 98 commits into from
Apr 12, 2024

Conversation

marcaaron
Copy link
Contributor

@marcaaron marcaaron commented Apr 5, 2024

Details

Holding on...

Fixed Issues

$ #34927

Tests

  1. Sign in as User B and User A
  2. As User A - start creating a new Group Chat with User B and User C
  3. Tap avatar to add a custom icon
  4. Change the name
  5. Tap “Create group”
  6. Verify you are brought to the new chat
  7. Verify the avatar is the same in the header and the welcome message
  8. Verify the report name reflects the name you entered when creating the chat
  9. As User A tap the avatar in the header of the chat
  10. Verify the Details page shows an editable avatar
  11. Verify you see both “Leave” and “Pin” buttons
  12. Verify the “Share code” row is present
  13. Verify the “Members” row is present and shows 3 members
  14. Verify the “Settings” and “Private notes” rows are present.
  15. Tap the “Pin” button and verify that the report can be pinned.
  16. Verify the text changes to “Unpin” and that tapping “Unpin” will unpin.
  17. Tap the Avatar icon and select “Remove photo”
  18. Verify the photo is removed from the Details, Header, LHN, and welcome message.
  19. Tap the avatar icon again and select “Upload photo”
  20. Verify the photo is added to the Details, Header, LHN, and welcome message.
  21. Repeat editing avatar as User B and User C and confirm they can also do this.
  22. As User A tap “Settings”
  23. Tap “Name”
  24. Enter over 255 characters in the Name text input field
  25. Verify an error is displayed on pressing “Save”.
  26. Remove all the text
  27. Verify the report name becomes a default with emails + first name in alphabetical order.
  28. Verify the name also updates in the expected places: Details, Header, LHN, and welcome message
  29. Verify that User B and User C can also update the name.
  30. As User A navigate to “Members”
  31. Verify that the list of Users is displayed in a table style.
  32. Attempt to check User A in the list and verify that they cannot be selected.
  33. Verify that tapping each user will navigate to a profile page for the user.
  34. Tap the checkbox next to User B
  35. Verify that the “Invite member” button appears with a drop down selector.
  36. Verify the options show as “Remove members”, “Make admin” or “Make member”
  37. Select “Make admin”
  38. Verify that User B is now shown as an admin.
  39. As User B navigate to the Members view
  40. Select User C and select “Remove members”
  41. Verify a warning appears and select Cancel
  42. Attempt to remove again and select “Remove”
  43. Verify the user is removed from the group
  44. Verify a message shows in the chat that User B removed User C
  45. As User B tap “Invite member”
  46. Verify that a list of potential members is shown
  47. Verify that selecting a row with stage that member for invite.
  48. Verify that members can be searched by name.
  49. Select a few members
  50. Tap “Invite”
  51. Verify that the members now appear in the directory
  52. Verify that “invited [member1], [member 2], and [member 3]” comment shows in the chat
  53. Tap the name of the first invited member
  54. Tap the “Role” field
  55. Select “Admin”
  56. Go back to the directory and verify they are now an admin
  57. Tap the second invited member
  58. Select “Remove from group”
  59. Verify a warning appears and dismiss
  60. Select again. Tap “Remove”
  61. Verify we are navigated back to the directory and user is removed.
  62. Using the checkbox select the two remaining invited members.
  63. Use the bulk action to remove them.
  64. Select everyone remaining and demote them to “Members” via the bulk action.
  65. Verify that it is no longer possible for any former admins to take actions reserved for admins only (remove members, change role).
  66. Verify that anyone with the “Member” role is able to invite new members to the chat.
  67. Create a GitHub issue to add these test steps to TestRail
  • Verify that no errors appear in the JS console

Offline tests

Offline adding Group Chat member(s)

  1. Add a member to the Group chat while offline
  2. Verify they show greyed out as "pending"
  3. Come online
  4. Verify they become not grey
  5. Repeat with bulk action

Offline remove Group Chat member(s)

  1. Add a member to the Group chat while offline
  2. Verify they show greyed out and strike through as "deleted"
  3. Come online
  4. Verify they disappear
  5. Repeat with bulk action

QA Steps

  1. Same as Tests and Offline
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I verified that similar component doesn't exist in the codebase
  • I verified that all props are defined accurately and each prop has a /** comment above it */
  • I verified that each file is named correctly
  • I verified that each component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
  • I verified that the only data being stored in component state is data necessary for rendering and nothing else
  • In component if we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
  • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
  • I verified that component internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
  • I verified that all JSX used for rendering exists in the render method
  • I verified that each component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions

Screenshots/Videos

Android: Native
Android: mWeb Chrome

2024-04-11_16-57-46
2024-04-11_16-56-53

iOS: Native

2024-04-11_17-59-04

iOS: mWeb Safari

2024-04-11_16-44-37

MacOS: Chrome / Safari
2024-04-09_19-00-50.mp4
MacOS: Desktop

2024-04-11_17-02-38

Follow up issues

@marcaaron
Copy link
Contributor Author

Definitely will need to be cleaning this up and there is guaranteed 1 million typescript errors. But I think most of the functionality is working. 😄

I wired up the API commands and fixing some style issues from the first PR. There are still both style and code issues that need to be addressed. @waterim did a great job of setting up the UI stuff.

@marcaaron marcaaron requested a review from s77rt April 6, 2024 02:54
Copy link
Contributor

@s77rt s77rt left a comment

Choose a reason for hiding this comment

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

Partial review

src/SCREENS.ts Show resolved Hide resolved
src/components/AvatarWithImagePicker.tsx Outdated Show resolved Hide resolved
src/components/AvatarWithImagePicker.tsx Outdated Show resolved Hide resolved
src/components/ChatActionsBar.tsx Outdated Show resolved Hide resolved
src/components/ChatActionsBar.tsx Outdated Show resolved Hide resolved
src/libs/ReportUtils.ts Outdated Show resolved Hide resolved
src/libs/ReportUtils.ts Outdated Show resolved Hide resolved
src/libs/ReportUtils.ts Outdated Show resolved Hide resolved
src/libs/ReportUtils.ts Show resolved Hide resolved
src/types/onyx/NewGroupChatDraft.ts Outdated Show resolved Hide resolved
@s77rt
Copy link
Contributor

s77rt commented Apr 7, 2024

Seeing option to remove photo where this is no photo

Screenshot 2024-04-06 at 6 11 44 PM

@s77rt
Copy link
Contributor

s77rt commented Apr 7, 2024

(I need to check this later) The chat draft not being used

Screen.Recording.2024-04-06.at.6.18.13.PM.mov

@s77rt
Copy link
Contributor

s77rt commented Apr 7, 2024

Custom avatar not taken into consideration on new chat creation

Screen.Recording.2024-04-06.at.6.23.11.PM.mov

@s77rt
Copy link
Contributor

s77rt commented Apr 7, 2024

Can access the report participant details for an invalid user and for a user that does not belong to the group
Screenshot 2024-04-06 at 11 30 49 PM
Screenshot 2024-04-06 at 11 32 14 PM

@s77rt
Copy link
Contributor

s77rt commented Apr 7, 2024

Is it expected to see users as "Hidden" in the group?
Screenshot 2024-04-07 at 2 23 26 AM

@s77rt
Copy link
Contributor

s77rt commented Apr 12, 2024

Trying to upload a large image shows the error incorrectly

Screenshot 2024-04-12 at 11 45 09 PM

@s77rt
Copy link
Contributor

s77rt commented Apr 12, 2024

When creating a new group chat, if we choose a picture, go back and proceed again the picture is not taken into consideration

Screen.Recording.2024-04-12.at.11.51.46.PM.mov

@marcaaron
Copy link
Contributor Author

Gonna merge this one so we can get started on the polish and follow up issues. There's a good amount of work left to do, but feels like this is in a good state for internal testing and feedback. This also probably won't get onto staging until Monday. Thanks for all the reviews!

@marcaaron marcaaron merged commit 5602b63 into main Apr 12, 2024
18 of 24 checks passed
@marcaaron marcaaron deleted the feature-groupChats2 branch April 12, 2024 23:39
@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 https://github.com/marcaaron in version: 1.4.63-0 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/mountiny in version: 1.4.63-21 🚀

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

@lanitochka17
Copy link

This PR is failing because of issue #43212

Bug6504171_1717693912593.2024-06-06_19-09-07.mp4

return;
}

Report.leaveGroupChat(report.reportID);
Copy link
Contributor

@s77rt s77rt Jul 7, 2024

Choose a reason for hiding this comment

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

When we leave a group chat we replace the current screen with the most recent report so the group chat is no longer in stack. However in this case the function is called from a RHP screen.

If the stack is as follow:

  • report 1 -> report 1 details page

and we leave the group, the stack will be:

  • report 1 -> report 2

report 1 can still be accessed by going back (bug).

To fix this we opted to dismiss any RHP modal before proceeding

(From #44152)

>
<HeaderWithBackButton
title={translate('groupConfirmPage.groupName')}
onBackButtonPress={() => Navigation.goBack(isUpdatingExistingReport ? ROUTES.REPORT_SETTINGS.getRoute(reportID) : ROUTES.NEW_CHAT_CONFIRM)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey folks👋
This has caused #45812, essentially, you vere navigated back to the wrong page after refreshing GroupChatNameEditPage. This was resolved by using ROUTES.REPORT_WITH_ID_DETAILS instead of ROUTES.REPORT_SETTINGS

Comment on lines +2457 to +2458
navigateToMostRecentReport(report);
API.write(WRITE_COMMANDS.LEAVE_GROUP_CHAT, {reportID}, {optimisticData});
Copy link
Member

Choose a reason for hiding this comment

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

Optimistic changes take effect before navigation is done causing the not found page to show up briefly which caused mWeb - Group chat - Not here page appears briefly when last member leave the group chat

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

Successfully merging this pull request may close these issues.