App icon indicating copy to clipboard operation
App copied to clipboard

Fix 53003 on room invite sms shown

Open Kalydosos opened this issue 1 year ago • 39 comments

Explanation of Change

Fixed Issues

$ https://github.com/Expensify/App/issues/53003 PROPOSAL: https://github.com/Expensify/App/issues/53003#issuecomment-2495946266

Tests

  1. Launch app
  2. Open a room chat
  3. Invite a phone number via suggestion eg: +919789945670
  4. Send the message
  5. From whisper, tap invite
  6. Tap header -- member
  7. Open the phone number member
  8. Note expensify.sms is not shown with phone number
  • [x] Verify that no errors appear in the JS console

Offline tests

QA Steps

Same as tests

  • [x] Verify that no errors appear in the JS console

PR Author Checklist

  • [x] I linked the correct issue in the ### Fixed Issues section above
  • [x] I wrote clear testing steps that cover the changes made in this PR
    • [x] I added steps for local testing in the Tests section
    • [x] I added steps for the expected offline behavior in the Offline steps section
    • [x] I added steps for Staging and/or Production testing in the QA steps section
    • [x] I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • [x] 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)
    • [x] 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).
  • [x] I included screenshots or videos for tests on all platforms
  • [x] I ran the tests on all platforms & verified they passed on:
    • [x] Android: Native
    • [x] Android: mWeb Chrome
    • [x] iOS: Native
    • [x] iOS: mWeb Safari
    • [x] MacOS: Chrome / Safari
    • [x] MacOS: Desktop
  • [x] 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)
  • [x] I followed proper code patterns (see Reviewing the code)
    • [x] 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)
    • [x] I verified that comments were added to code that is not self explanatory
    • [x] 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.
    • [x] I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • [x] If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • [x] I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • [x] 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)
    • [x] 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.
    • [x] I verified the JSDocs style guidelines (in STYLE.md) were followed
  • [x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • [x] I followed the guidelines as stated in the Review Guidelines
  • [x] 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)
  • [x] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • [x] I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • [x] I verified that if a function's arguments changed that all usages have also been updated correctly
  • [x] If any new file was added I verified that:
    • [x] 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
  • [x] If a new CSS style is added I verified that:
    • [x] A similar style doesn't already exist
    • [x] The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • [x] 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.
  • [x] 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)
  • [x] 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.
  • [x] 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.
  • [x] 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:
    • [x] I verified that all the inputs inside a form are aligned with each other.
    • [x] I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • [x] 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.
  • [x] I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • [x] 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.

Screenshots/Videos

Android: Native

https://github.com/user-attachments/assets/27f24634-140f-4e3a-9cf7-de6f835d3f62

Android: mWeb Chrome

https://github.com/user-attachments/assets/f46e0e21-5fe4-4d67-b3cc-9d8ca3464ea6

iOS: Native

ios_native

iOS: mWeb Safari

ios_mweb_safari

MacOS: Chrome / Safari

fix_ios_safari

MacOS: Desktop

macos-desktop

Kalydosos avatar Nov 28 '24 07:11 Kalydosos

@jayeshmangwani Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

melvin-bot[bot] avatar Nov 28 '24 07:11 melvin-bot[bot]

will be changing images for android tests

Kalydosos avatar Nov 28 '24 07:11 Kalydosos

Thanks for the PR! Please also address the ESLint errors and fix the unit tests.

jayeshmangwani avatar Nov 28 '24 07:11 jayeshmangwani

ok, i'm working on it

Kalydosos avatar Nov 28 '24 07:11 Kalydosos

Thanks for the PR! Please also address the ESLint errors and fix the unit tests.

the unit tests said failed seems have passed but they are marked failed, what do you think ?

Kalydosos avatar Nov 28 '24 08:11 Kalydosos

the unit tests said failed seems have passed but they are marked failed, what do you think ?

maybe try to merge latest main branch and push again

jayeshmangwani avatar Nov 28 '24 09:11 jayeshmangwani

@Kalydosos Have you tested all 13 files where you made these changes?

jayeshmangwani avatar Nov 28 '24 10:11 jayeshmangwani

@jayeshmangwani the problem with the tests is the 'NO-BREAK SPACE' (U+00A0) character used here https://github.com/Expensify/App/blob/be6468c5b37cff87749c42dbd10f018c9b7a98a9/src/libs/LocalePhoneNumber.ts#L23

i will modify the tests to replace spaces inside the static strings by that same character like here https://github.com/Expensify/App/blob/be6468c5b37cff87749c42dbd10f018c9b7a98a9/tests/unit/ReportUtilsTest.ts#L101

Kalydosos avatar Nov 28 '24 13:11 Kalydosos

@Kalydosos Lint is failing here, can you please fix it

jayeshmangwani avatar Nov 29 '24 09:11 jayeshmangwani

the problem with the tests is the 'NO-BREAK SPACE' (U+00A0) character used here

I believe we shouldn't change the tests in this PR, as the failures don't seem to be caused by our changes. Or am I missing something?

jayeshmangwani avatar Nov 29 '24 09:11 jayeshmangwani

I believe we shouldn't change the tests in this PR, as the failures don't seem to be caused by our changes. Or am I missing something?

@jayeshmangwani formatPhoneNumber replace simple space characters by no-break space characters (which make sense)

https://github.com/Expensify/App/blob/be6468c5b37cff87749c42dbd10f018c9b7a98a9/src/libs/LocalePhoneNumber.ts#L23

need_change_tests

Kalydosos avatar Nov 29 '24 12:11 Kalydosos

@Kalydosos Lint is failing here, can you please fix it

@jayeshmangwani the current lint failure have to do with the legacy use of withOnyx in some of the files. It is not from our changes. I guess to deploy on staging they will have to skip that test https://github.com/Expensify/App/actions/runs/12071160259/job/33662272975?pr=53240

Kalydosos avatar Nov 29 '24 12:11 Kalydosos

@jayeshmangwani what's next ?

Kalydosos avatar Dec 04 '24 18:12 Kalydosos

what's next ?

@Kalydosos I have tested the code, and there are a few things that I think we need to address:

  1. We need to migrate the usage from withOnyx to useOnyx on the ReportParticipantDetails and ArchivedReportFooter pages.
  2. I am unable to assign you the cards. If we cannot test that change right now, we should revert it.
  3. Apart from the cards pages, have you tested all the other pages where you made changes?

jayeshmangwani avatar Dec 04 '24 18:12 jayeshmangwani

@jayeshmangwani there are 3 files (also ProfileAvatar) with withOnyx, that's a lot of potential regressions, really i'm not a fan of the idea, considering also the widespread of our changes. Cant you test the cards otherwise i'll revert these (i dont think phone numbers are displayed on cards anyway). I have tested all the other pages.

Kalydosos avatar Dec 04 '24 19:12 Kalydosos

that's a lot of potential regressions

@Kalydosos What are you seeing that’s very hard to test in those files, and could potentially cause regression?

jayeshmangwani avatar Dec 04 '24 19:12 jayeshmangwani

i will make the migrations @jayeshmangwani, but there is often some unexpected bug when fixing many things at once

Kalydosos avatar Dec 04 '24 21:12 Kalydosos

Yes that may be a chance but let's try to test it thoroughly

jayeshmangwani avatar Dec 04 '24 21:12 jayeshmangwani

@jayeshmangwani i did the migrations and tested it. All seems right but i would appreciate if you can do a visual check on ArchivedReportFooter and confirms the behavior as correct. Thx. If its all good i think we are all set then for merging. Agreed ?

Kalydosos avatar Dec 05 '24 14:12 Kalydosos

Thank you @Kalydosos for implementing the useOnyx changes.

I’ve visually tested the updates to ArchivedReportFooter and have some feedback to share. Additionally, I’ve noticed a few other issues. Let me complete testing on other pages first, and then I’ll post a consolidated review.

jayeshmangwani avatar Dec 05 '24 15:12 jayeshmangwani

@Kalydosos If you want to test the ArchivedReportFooter, follow these steps:

  1. Go to any workspace.
  2. Invite a user with a phone number.
  3. Remove that member from the workspace.
  4. Navigate to the home page, then search for that user (by their phone number) and the corresponding workspace chat.
  5. Check the message displayed at the bottom.

Based on my testing in the staging environment, it seems we don’t need to make any changes to the ArchivedReportFooter. The formatted phone number is already displayed correctly. However, let me know if your results differ from mine. Screenshot 2024-12-05 at 22 48 29

jayeshmangwani avatar Dec 05 '24 20:12 jayeshmangwani

We haven’t added the changes to the Workspace Member Details page yet, so we need to update that page as well.

Steps to Verify:

  1. Go to any workspace.
  2. Invite a user with a phone number.
  3. Click on that user to open their details.
  4. Check the header and the phone number displayed. You’ll notice it currently shows ".sms". Screenshot 2024-12-05 at 22 47 31

jayeshmangwani avatar Dec 05 '24 20:12 jayeshmangwani

@jayeshmangwani about ArchivedReportFooter i could not found the user (step 4). Maybe you can show me that step in video. And about that file, we dont modify the display names, we format it when displaying the reason of the archiving but it seems like that reason is not displayed anymore. Anyway, i remove the change as i couldnt see the reason displayed (i just make sure the page is displayed with no obvious bug) https://github.com/Kalydosos/App/blob/fix-53003-on-room-invite-sms-shown/src/components/ArchivedReportFooter.tsx#L53-L61

In the process, i fix a few other places where i see the bug including the Workspace Member Details page workspacemember_before workspacemember_after

Kalydosos avatar Dec 06 '24 09:12 Kalydosos

@Kalydosos I hope you have tested other pages where the username can include .sms

jayeshmangwani avatar Dec 06 '24 09:12 jayeshmangwani

@Kalydosos I hope you have tested other pages where the username can include .sms

the ones i modified yes

Kalydosos avatar Dec 06 '24 09:12 Kalydosos

the ones i modified yes

Not where you have modified, but rather where we are using the displayName

jayeshmangwani avatar Dec 06 '24 09:12 jayeshmangwani

about ArchivedReportFooter i could not found the user (step 4). Maybe you can show me that step in video

I hope the video below will help, but let me know if these steps don't work.

https://github.com/user-attachments/assets/a823ea6c-702c-42c7-a880-d34a13627a5e

jayeshmangwani avatar Dec 06 '24 09:12 jayeshmangwani

@jayeshmangwani i dont understand clearly what you are meaning. There a lot of pages where we display sms in the display name as i have notice, that should be a whole refactoring ticket as it involves also librairies like Search. We cant not exhaustively get it all done in this ticket here. A ticket should be specific for it, with a bounty that matches that extensive effort. We have done a lot of changes in this ticket already, we can not reasonably do everything in this one ticket

Kalydosos avatar Dec 06 '24 09:12 Kalydosos

@Kalydosos I'm not sure what to say here, but at the very least, we can address the issue we’ve identified since it involves only a single-line change. The workspace member details were a clear and manageable change that we could have handled earlier. I feel a simple change has been stretched unnecessarily. Please fix any issues you encounter during testing, and I’ll report if I find anything after your changes. It’s okay; we don’t need to refactor everything at this stage.

cc: @luacmartins

jayeshmangwani avatar Dec 06 '24 09:12 jayeshmangwani

@jayeshmangwani i did. But there are surely other pages out there with same issue. I cannot start tracking them in the context of this ticet that's what i'm saying. I can eventually start afresh in a new ticket dedicated to that objective, the process will then be different and the result assured. we are indeed overstretching here and it's confusing as one can easily loose focus.

Kalydosos avatar Dec 06 '24 09:12 Kalydosos