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

Thread subheaders and parent navigation #21092

Merged
merged 39 commits into from
Jul 3, 2023
Merged

Conversation

chiragsalian
Copy link
Contributor

@chiragsalian chiragsalian commented Jun 20, 2023

Details

Adding subheaders and parent navigation for child reports. The latest on where we landed for this is mentioned here

i.e.,

  • If the report discussion is tied to a workspace, the name logic takes the form: From <parent report name> in <workspace name>
    • Because the workspace chat is the name of the workspace for members, that header takes the form: From <parent report name>
  • If the report discussion is not tied to a workspace, the name logic takes the form: From <parent report name>

Fixed Issues

$ #20844
PROPOSAL: GH_LINK_ISSUE(COMMENT)

Tests

Regular DMs

  1. Start a DM between userA and userB.
  2. Create a thread. Have both users visit the thread.
  3. Confirm userA sees the subheader From <userB full name>. (its basically From <parent report name>)
  4. Confirm userB sees the subheader From <userA full name>
  5. Click on the subheader and confirm you are navigated up one level to parent.
    image

Group DMs

  1. Start a DM between userA, userB and userC.
  2. Create a thread. Have userA visit the thread.
  3. Confirm userA sees the subheader From <userB>, <userC> (i.e., From <parent report name>)
  4. Click on the subheader and confirm you are navigated up one level to parent.
    image

Task DM

  1. Start a DM between userA and userB.
  2. Create a task. Have both users visit the task. (you might have to refresh or exit and revisit this task report because at the time of writing optimistic data and onyx data are not properly received so a refresh or revisit should fetch the latest data)
  3. Confirm userA sees the subheader From <userB full name>. (its basically From <parent report name>)
  4. Confirm userB sees the subheader From <userA full name>
  5. Click on the subheader and confirm you are navigated up one level to parent.
    image

IOUs

  1. Start a DM between userA and userB.
  2. Click on the plus actions icon next to "write something.." in the compose message box and select "request money".
  3. Click on the expense request preview.
  4. In the expense report, confirm the subheader says From <userA full name>
    image

IOUs children

  1. Continuing from previous. Click on the specific expense in the expense report.
  2. Confirm you see the single expense request view. Confirm the subheader says From <parent IOU report name>
    The parent IOU report can be seen in the LHN. In the below screenshot the parent IOU report name is "Marc Glasser owes $20.00" and so the child has that as its subheader.
    image
  3. Click on the subheader and confirm you are navigated up one level to parent.
  4. Create another thread in the expense report, Or a few nested thread. Confirm all thread subheaders show From <parent IOU report name>.
    image

Policy room threads

  1. Create a public room. Have userA and userB join the public room.
  2. Create a thread. Have both users visit the thread.
  3. Confirm userA and userB sees the subheader From <public room name> in <workspace name>
  4. Create another thread and confirm the subheader is the same.
  5. Click on the subheader and confirm you are navigated up one level to parent.
    image

Policy room tasks

  1. Create a public room. Have userA and userB join the public room.
  2. Create a task and assign it to userB. The task report most likely should automatically open, if not click into it (if you do not see a subheader you need to refresh or revisit the task to fetch the latest data)
  3. Confirm userA sees the subheader From <public room name> in <workspace name>.
    image

Expense Chats

  1. Create a workspace. As admin userA, invite userB to the workspace.
  2. You should see a workspace chat between the two like so (view for the admin is below, for a member it will look slightly different),
    image
  3. As userB, click on the plus actions button in the compose message and select "request money"
  4. Once requested have userA and userB click on the expense preview to view the expense report.
  5. Confirm userA, the admin sees the subheader, From <userB full name> in <workspace name>
    image
  6. Confirm userB, the member sees the subheader From <workspace name>
    image
  7. Click on the subheader and confirm you are navigated up one level to parent.

Expense chats children

  1. Continuation from the previous section, click on a specific expense request.
  2. Confirm both admin and member sees From <Expense parent report name> in <workspace name>. The Expense parent report name can be seen in the LHN of the expense report.
  3. Create any number of threads or nested threads under the expense report and confirm the subheader for them all is From <Expense parent report name> in <workspace name>.
    image
  4. Click on the subheader and confirm you are always navigated up one level to parent.
  • Verify that no errors appear in the JS console

Offline tests

None, haven't made any API changes so we're not testing optimistic/offline steps for these flows for now.

QA Steps

Same as Web-tests

  • 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 / Chrome
    • iOS / native
    • iOS / 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 approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • 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 a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • 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)
    • Any 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)
    • All JSX used for rendering exists in the render method
    • The 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
  • 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(themeColors.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 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 have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web

Without workspace (IOU report)
image

Without workspace (IOU report child)
image

With workspace (expense report)
image

With workspace (expense report child)
image

Mobile Web - Chrome
Mobile Web - Safari

Without workspace (IOU report)
image

Without workspace (IOU report child)
image

With workspace (expense report)
image

With workspace (expense report child)
image

Desktop

Without workspace (IOU report)
image

Without workspace (IOU report child)
image

With workspace (expense report)
image

With workspace (expense report child)
image

iOS

Without workspace (IOU report)
image

Without workspace (IOU report child)
image

With workspace (expense report)
image

With workspace (expense report child)
image

Android

@chiragsalian chiragsalian self-assigned this Jun 20, 2023
@chiragsalian chiragsalian changed the title Non-chat headers Thread subheaders and parent navigation Jun 20, 2023
if (props.isSingleTransactionView) {
report.ownerAccountID = lodashGet(props, ['parentReport', 'ownerAccountID'], null);
report.ownerEmail = lodashGet(props, ['parentReport', 'ownerEmail'], '');
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@luacmartins, can you check if this change and the one below where i remove parentReport from HeaderWithBackButton breaks anything with single expense/IOU view?

also cc @grgia for awareness as this code change affects report headers since we're providing source report instead of parent report to HeaderWithBackButton.

Copy link
Contributor

Choose a reason for hiding this comment

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

Some of these checks depend on the report type, which can be different with your changes. Previously, the report type of the parentReport on a singleTransactionView was iou or expense and now it'll always be chat.

The only difference that I noticed with your changes is that the Workspace subscript avatar is missing in the single transaction view. There might be others given the type checks we do in the code I linked above.

Before
expense-transaction

After
Screenshot 2023-06-21 at 1 09 39 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm i think that geogia is changing the avatar anyway. @grgia do you know what the final avatar for this single expense request is supposed to be. Is it supposed to be with a workspace subscript? If so i think i can easily add it in using the current report instead of having the parent report.

@chiragsalian chiragsalian marked this pull request as ready for review June 21, 2023 00:37
@luacmartins luacmartins changed the title Thread subheaders and parent navigation [HOLD Feature freeze] Thread subheaders and parent navigation Jun 27, 2023
@luacmartins luacmartins changed the title [HOLD Feature freeze] Thread subheaders and parent navigation Thread subheaders and parent navigation Jun 28, 2023
@luacmartins
Copy link
Contributor

Removed the feature freeze hold. @chiragsalian it looks like @grgia left a few comments.

@luacmartins
Copy link
Contributor

@chiragsalian we have conflicts too!

@chiragsalian
Copy link
Contributor Author

oops i missed georgia's comments earlier. I was just thinking as soon as feature freeze was done we would merge this. Either way, i replied to her comments and updated the PR to address merge conflicts.

Feel free to review/merge.

@grgia
Copy link
Contributor

grgia commented Jul 3, 2023

Pulled and testing a few cases locally!

Copy link
Contributor

@grgia grgia left a comment

Choose a reason for hiding this comment

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

changes LGTM and tests well!

Copy link
Contributor

@thienlnam thienlnam left a comment

Choose a reason for hiding this comment

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

Approving and sending since we have all approvals and quite a few issues are holding on this

@thienlnam thienlnam merged commit 4d3c4ef into main Jul 3, 2023
@thienlnam thienlnam deleted the chirag-nonChat-headers branch July 3, 2023 18:35
@OSBotify
Copy link
Contributor

OSBotify commented Jul 3, 2023

✋ 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

OSBotify commented Jul 5, 2023

🚀 Deployed to staging by https://github.com/thienlnam in version: 1.3.37-0 🚀

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

@OSBotify
Copy link
Contributor

OSBotify commented Jul 7, 2023

🚀 Deployed to production by https://github.com/Julesssss in version: 1.3.37-7 🚀

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

onPress={() => {
Navigation.navigate(ROUTES.getReportRoute(props.report.parentReportID));
}}
style={[styles.alignSelfStart, styles.mw100]}
Copy link
Contributor

Choose a reason for hiding this comment

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

@chiragsalian this was accidentally removed while fixing conflict.
I raised follow-up PR.

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.

6 participants