[HOLD for payment 2024-11-29] [$250] Workspace - User is navigate to thread message when going to #announce room
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.56-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A 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:
- Navigate to staging.new.expensify.com
- Create a workspace > add 2 members
- Go to #announce room
- Send a message > Create a thread message
- Navigate to Workspace > Click on the three dot menu > Click #announce
Expected Result:
User is navigated to #announce room main page
Actual Result:
User is navigated to #announce room thread message page
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- [ ] Android: Standalone
- [ ] Android: HybridApp
- [x] Android: mWeb Chrome
- [ ] iOS: Standalone
- [ ] iOS: HybridApp
- [ ] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [x] MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/user-attachments/assets/9b97bba9-4001-40d6-8c57-803be16c45b2
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021852040470527704127
- Upwork Job ID: 1852040470527704127
- Last Price Increase: 2024-11-07
- Automatic offers:
- Nodebrute | Contributor | 104835368
Issue Owner
Current Issue Owner: @eVoloshchak
Triggered auto assignment to @garrettmknight (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.
@garrettmknight 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
Edited by proposal-police: This proposal was edited at 2024-10-31 17:34:21 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
User is navigate to thread message when going to #announce room
What is the root cause of that problem?
This issue occurs not only with the #announce room but also with the #admins room. This happens because the threads created in these rooms also have a chatType of adminroom, and in this switch statement, we’re checking specifically for chatType. https://github.com/Expensify/App/blob/6463c2b62e9b7c754223a8b771b1b7e8a06822d1/src/pages/workspace/WorkspacesListPage.tsx#L283-L294
What changes do you think we should make in order to solve the problem?
We should early return if report has parentReportID here
https://github.com/Expensify/App/blob/6463c2b62e9b7c754223a8b771b1b7e8a06822d1/src/pages/workspace/WorkspacesListPage.tsx#L274
if (!report?.reportID || !report.policyID || report.parentReportID) {
return result;
}
Alternatively, we can also use parentReportActionID.
What alternative solutions did you explore? (Optional)
Alternatively, instead of using chatType in the switch statement, we could use reportName, as these room names are only used for workspace rooms.
pseudo-code
switch (report.reportName) {
case CONST.REPORT.WORKSPACE_CHAT_ROOMS.ADMINS:
// eslint-disable-next-line no-param-reassign
result[report.policyID].adminRoom = report.reportID;
break;
case CONST.REPORT.WORKSPACE_CHAT_ROOMS.ANNOUNCE:
// eslint-disable-next-line no-param-reassign
result[report.policyID].announceRoom = report.reportID;
break;
default:
break;
}
Job added to Upwork: https://www.upwork.com/jobs/~021852040470527704127
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak (External)
Proposal
Please re-state the problem that we are trying to solve in this issue.
- User is navigated to #announce room thread message page
What is the root cause of that problem?
- Here’s the logic to retrieve the announce room:
https://github.com/Expensify/App/blob/6463c2b62e9b7c754223a8b771b1b7e8a06822d1/src/pages/workspace/WorkspacesListPage.tsx#L351
we first search for it in the reports data. If no valid report is found, we then fall back on the chatReportIDAnnounce data associated with each policy.
- However, when looking for the announce room ID within the reports data, we're mistakenly identifying any report with
chatType === policyAnnounceas the announce room:
https://github.com/Expensify/App/blob/6463c2b62e9b7c754223a8b771b1b7e8a06822d1/src/pages/workspace/WorkspacesListPage.tsx#L283 https://github.com/Expensify/App/blob/6463c2b62e9b7c754223a8b771b1b7e8a06822d1/src/pages/workspace/WorkspacesListPage.tsx#L288-L290
when in fact, the announce room’s thread also has chatType === policyAnnounce.
As a result, the value assigned to result[report.policyID].announceRoom might actually point to the announce room's thread instead.
What changes do you think we should make in order to solve the problem?
- Because the
chatReportIDAnnouncedata is available for each policy, we can make use of that data. Using the original approach (searching for the reports data first then fall back to chatReportIDAnnounce) is not proper in case there are a lot of reports, the announce room report is not fetched yet. So this line:
can be:
announceRoom: (policy.chatReportIDAnnounce ? policy.chatReportIDAnnounce?.toString() : '') || policyRooms?.[policy.id]?.announceRoom,
- The above change almost fixes the bug. But in case BE misses
chatReportIDAnnouncedata, so we still need to get the announce report data from the reports data. In this case, we need to update this line:
if (ReportUtils.isThread(report)) {
return result;
}
What alternative solutions did you explore? (Optional)
- The similar issue can be reproduced with admin room, and the similar solution can be applied.
@garrettmknight, @eVoloshchak Eep! 4 days overdue now. Issues have feelings too...
@eVoloshchak can you please review this proposal?
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
We should proceed with @daledah's proposal, since It makes use of the already-existing ReportUtils.isThread method
🎀👀🎀 C+ reviewed!
Triggered auto assignment to @mountiny, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@eVoloshchak Hey, the isThread method uses the same report.parentReportID and parentReportActionID under the hood as my main proposal
https://github.com/Expensify/App/blob/b8210689939b584ac7f371a721c738ff4d18febe/src/libs/ReportUtils.ts#L1192
So, I don't think selecting a proposal that relies on a utility function with the same logic as my solution is fair. Also, I was the first to provide the correct solution and root cause analysis. As far as I know, that proposal should be significantly different from the previous ones, but I don’t see any real difference here.
Note: Before submitting a proposal on an issue, be sure to read any other existing proposals. ALL NEW PROPOSALS MUST BE DIFFERENT FROM EXISTING PROPOSALS. The difference should be important, meaningful or considerable.
cc: @mountiny
📣 @Nodebrute 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻 Keep in mind: Code of Conduct | Contributing 📖
I agree, I think @Nodebrute already nailed it and it was first, also noted its valid issue for admins room too, can you fix it there too?
@mountiny Thank you so much! My solution will fix it for both rooms.
@Nodebrute, we are also working on a new process which will require adding unit tests for each bug fix to increase the chances of this issue not getting re-introduced. Can you also add unit tests to cover this case please?
Yes, sure. PR will be ready in few hours.
@Nodebrute appreciated
Reviewing label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.65-5 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
- https://github.com/Expensify/App/pull/52349
If no regressions arise, payment will be issued on 2024-11-29. :confetti_ball:
For reference, here are some details about the assignees on this issue:
- @eVoloshchak requires payment through NewDot Manual Requests
- @Nodebrute requires payment automatic offer (Contributor)
@eVoloshchak @garrettmknight @eVoloshchak The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
@eVoloshchak can you please complete the checklist here? Thanks!
@garrettmknight, @eVoloshchak, @mountiny, @Nodebrute Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
@eVoloshchak bump on the checklist.
@Nodebrute just paid you out.
@eVoloshchak bump on the checklist.
@garrettmknight, @eVoloshchak, @mountiny, @Nodebrute Whoops! This issue is 2 days overdue. Let's get this updated quick!
- The PR that introduced the bug has been identified. Link to the PR: https://github.com/Expensify/App/pull/33280
- 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: https://github.com/Expensify/App/pull/33280/files#r1875956571
- 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: Not sure if additional discussion is needed, this Is a pretty simple navigation bug
- Determine if we should create a regression test for this bug Is it easy to test for this bug? Yes Is the bug related to an important user flow? Yes Is it an impactful bug? Yes This isn't a critical bug, but it is pretty impactful and related to widely used functionality, we might add a regression test
Regression Test Proposal
- Create a workspace > add 2 members
- Go to #announce room
- Send a message > Reply in thread -> send a message in thread
- Navigate to Settings/Workspaces > Click on the three-dot menu > Click on
Go to #announce room - Verify user is navigated to the #announce room
Do we agree 👍 or 👎
Payment Summary:
- Contributor: @Nodebrute $250 paid via Upwork
- Reveiwer: @eVoloshchak $250 via NewDot
$250 approved for @eVoloshchak