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

[HOLD for payment 2024-10-16] [$250] Track > Categorize it flow - Unable to search for workspace chats if the reports are not visited previously #47854

Closed
6 tasks done
lanitochka17 opened this issue Aug 22, 2024 · 69 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Aug 22, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.23-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Create a few workspaces
  3. Go to self DM
  4. Send a message
  5. Log out and log it
  6. Do not open any workspace chat and go to self DM
  7. Click + > Track expense > Manual
  8. Submit a track manual expense
  9. Click Categorize it
  10. Search for other existing workspace chats that do not show up in the list
  11. Note that the other existing workspace chats do not return in the search result
  12. Open all the workspace chats
  13. Repeat Step 9 and 10
  14. Note that workspace chats are only searchable after the workspace chats are visited

Expected Result:

In Step 11, user should be able to search for other existing workspace chats

Actual Result:

In Step 11, user is unable to search for other existing workspace chats
The search only returns results after the workspace chats are visited (Step 14)

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6579117_1724318988637.20240822_172134.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01570efd314fb561ac
  • Upwork Job ID: 1828744919457771906
  • Last Price Increase: 2024-09-18
  • Automatic offers:
    • dukenv0307 | Reviewer | 104043144
    • jaydamani | Contributor | 104043145
Issue OwnerCurrent Issue Owner: @dylanexpensify
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 22, 2024
Copy link

melvin-bot bot commented Aug 22, 2024

Triggered auto assignment to @dylanexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@lanitochka17
Copy link
Author

@dylanexpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@jaydamani
Copy link
Contributor

jaydamani commented Aug 22, 2024

Edited by proposal-police: This proposal was edited at 2023-10-04T22:06:00Z.

Proposal

Please re-state the problem that we are trying to solve in this issue.

When categorizing a tracked expense, only previously visited workspaces are shown

What is the root cause of that problem?

When categorizing expense, we do an additional check to see if the workspace has categories enabled by checking if policyCategory for that workspace has at least 1 category enabled but currently, when you logout and then login, policyCategory is not being loaded for workspaces with categories enabled. It is only loaded for workspace where the category feature and all categories are disabled. This data is supposed to come from OpenApp request. When you open a report, then also policyCategory is populated which is why we start to see the workspace after it is opened once

const policyCategories = allPolicyCategories?.[`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${reportOption.policyID}`] ?? {};

let allPolicyCategories: OnyxCollection<PolicyCategories> = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.POLICY_CATEGORIES,
waitForCollectionCallback: true,
callback: (val) => (allPolicyCategories = val),
});

image

What changes do you think we should make in order to solve the problem?

Update front end to check isCategoryEnabled in the policy then update here to call an API and load categories of the selected policy.
A new API will be needed from backend to load all categories of a given workspace.

What alternative solutions did you explore? (Optional)

Considering that policyCategory loads for workspace without categories but not for workspaces with categories, this likely requires a fix from backend most likely for OpenApp.

@klajdipaja
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

When submitting an expense and attempting to "Categorize" it into a workspace the "Categorize" modal does not show any options in the recent tab unless the user has opened each one of them in the current session.

What is the root cause of that problem?

The root cause of the problem is in OptionsListUtils.ts#getOptions where we filter out the reports that should be shown in the list. Currently the filtering returns only reports that have at least one enabled category in them by searching in Onyx storage for the list of ONYXKEYS.COLLECTION.POLICY_CATEGORIES and then each of them for enabled categories.

What changes do you think we should make in order to solve the problem?

We should change the approach to use the areCategoriesEnabled boolean in the policy data.
Lines

const policyCategories = allPolicyCategories?.[`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${reportOption.policyID}`] ?? {};
if (getEnabledCategoriesCount(policyCategories) !== 0) {
recentReportOptions.push(reportOption);
}

Should be replaced with:

      const reportOptionPolicy = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${reportOption.policyID}`] ?? {};
      if (reportOptionPolicy.areCategoriesEnabled) {
          recentReportOptions.push(reportOption);
      }

And after that we need to remove the connection to ONYXKEYS.COLLECTION.POLICY_CATEGORIES that we won't need anymore:
https://github.com/Expensify/App/blob/156f0a2bd0e94558ad621caa701bd749dd124bfe/src/libs/OptionsListUtils.ts#L279-284

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Overdue label Aug 26, 2024
Copy link

melvin-bot bot commented Aug 27, 2024

@dylanexpensify Eep! 4 days overdue now. Issues have feelings too...

@dylanexpensify dylanexpensify added the External Added to denote the issue can be worked on by a contributor label Aug 28, 2024
@melvin-bot melvin-bot bot changed the title Categorize - Unable to search for workspace chats if the reports are not visited previously [$250] Categorize - Unable to search for workspace chats if the reports are not visited previously Aug 28, 2024
Copy link

melvin-bot bot commented Aug 28, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01570efd314fb561ac

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 28, 2024
Copy link

melvin-bot bot commented Aug 28, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @dukenv0307 (External)

@melvin-bot melvin-bot bot removed the Overdue label Aug 28, 2024
@dukenv0307
Copy link
Contributor

@dylanexpensify I think it's BE bug, OpenApp API doesn't return the category of other WS if we have many workspaces.

If it's intended behavior, do we have the API to load the category if needed?

Copy link

melvin-bot bot commented Sep 2, 2024

@dylanexpensify, @dukenv0307 Huh... This is 4 days overdue. Who can take care of this?

@melvin-bot melvin-bot bot added the Overdue label Sep 2, 2024
Copy link

melvin-bot bot commented Sep 4, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented Sep 4, 2024

@dylanexpensify, @dukenv0307 Still overdue 6 days?! Let's take care of this!

Copy link

melvin-bot bot commented Sep 5, 2024

@dylanexpensify @dukenv0307 this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

Copy link

melvin-bot bot commented Sep 6, 2024

@dylanexpensify, @dukenv0307 Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!

@trjExpensify
Copy link
Contributor

@dylanexpensify I think it's BE bug, OpenApp API doesn't return the category of other WS if we have many workspaces.

If it's intended behavior, do we have the API to load the category if needed?

@dylanexpensify we need to get the answer to this to move it on. @thienlnam would be good to ask here for the Track > categorize it flow.

@trjExpensify trjExpensify changed the title [$250] Categorize - Unable to search for workspace chats if the reports are not visited previously [$250] Track > Categorize it flow - Unable to search for workspace chats if the reports are not visited previously Sep 10, 2024
@dylanexpensify
Copy link
Contributor

Apologies, assigning star to me and getting clarification!

@melvin-bot melvin-bot bot removed the Overdue label Sep 10, 2024
@thienlnam
Copy link
Contributor

This looks like an issue with createWorkspace not sending a pusher update for policy categories. I don't think that we did this on purpose to save onyx storage or anything so yeah this would require a BE fix

@melvin-bot melvin-bot bot added the Overdue label Sep 24, 2024
@thienlnam thienlnam removed the Overdue label Sep 24, 2024
@melvin-bot melvin-bot bot added the Overdue label Sep 24, 2024
@thienlnam
Copy link
Contributor

Should be live now

@melvin-bot melvin-bot bot removed the Overdue label Sep 24, 2024
@dylanexpensify
Copy link
Contributor

NICE!

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Sep 25, 2024
@jaydamani
Copy link
Contributor

Created a PR here

@dylanexpensify
Copy link
Contributor

Nice!

@dylanexpensify
Copy link
Contributor

pending @thienlnam review

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 9, 2024
@melvin-bot melvin-bot bot changed the title [$250] Track > Categorize it flow - Unable to search for workspace chats if the reports are not visited previously [HOLD for payment 2024-10-16] [$250] Track > Categorize it flow - Unable to search for workspace chats if the reports are not visited previously Oct 9, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 9, 2024
Copy link

melvin-bot bot commented Oct 9, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Oct 9, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.46-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-10-16. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Oct 9, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@dukenv0307] The PR that introduced the bug has been identified. Link to the PR:
  • [@dukenv0307] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@dukenv0307] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@dukenv0307] Determine if we should create a regression test for this bug.
  • [@dukenv0307] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@dylanexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 Overdue labels Oct 16, 2024
@dylanexpensify
Copy link
Contributor

Payment summary:

Contributor: @jaydamani $250 via Upwork
Contributor+: @dukenv0307 $250 via Upwork

Please apply/request!

@dylanexpensify
Copy link
Contributor

Payment done! @dukenv0307 please propose repro steps 🙇‍♂️

@jaydamani
Copy link
Contributor

jaydamani commented Oct 16, 2024

Payment summary:

Contributor: @jaydamani $250 via Upwork

Thanks, Received the payment. Also, thanks @dukenv0307 for reviewing the PR.

@dukenv0307
Copy link
Contributor

dukenv0307 commented Oct 17, 2024

BugZero Checklist:

  • The PR that introduced the bug has been identified. Link to the PR: N/A
  • The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: N/A
  • A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: N/A
  • Determine if we should create a regression test for this bug. Yes
  • If we decide to create a regression test for the bug, please propose the [regression test steps to ensure the same bug will not reach production again.

Regression test:

  1. Create a few workspaces
  2. Go to self DM
  3. Send a message
  4. Log out and log it
  5. Do not open any workspace chat and go to self DM
  6. Click + > Track expense > Manual
  7. Submit a track manual expense
  8. Click Categorize it
  9. Search for other existing workspace chats that do not show up in the list
  10. Note that the other existing workspace chats do not return in the search result
  11. Open all the workspace chats
  12. Repeat Step 9 and 10
  13. Note that workspace chats are only searchable after the workspace chats are visited

Do we 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Status: Polish
Development

No branches or pull requests

8 participants