Repository navigation
Conversation
A task inside a group chat is returned by the backend carrying the parent's chatType (e.g. group). getChatType now drops that inherited value for non-#admins tasks, so isGroupChat/isRootGroupChat/canLeaveChat no longer misclassify the task, the bogus Leave row and destructive leaveGroupChat path disappear, and the details page stops flashing the Not-here page. Keeps the intentional POLICY_ADMINS inheritance. Fixes Expensify#96421.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Tasks no longer classify as their parent's chat type, so a wiped group-inherited task stopped matching isGroupChat in isRemovalExpectedForReportType and the user would stay on the Not-here page instead of redirecting. Treat task removals as expected for the task type itself. Also pin canLeaveChat(task) === false and add a policy-room-inherited task case to the classification tests.
Give the fixture a visible participant so the assertion exercises the classification path rather than passing through hidden-membership.
|
@bernhardoj 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] |
|
@bernhardoj @trjExpensify ready for review. I've attached recordings for all five platforms. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17f26677ab
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| isAnnounceRoom(prevReport) || | ||
| // Tasks no longer classify as their parent's chat type (see getChatType), so removal | ||
| // must be expected for the task type itself to keep the Concierge redirect working. | ||
| isTaskReport(prevReport)); |
There was a problem hiding this comment.
Gate task removals to the current report
When this ReportScreen instance is retargeted to another report before that report's Onyx value has loaded, report is empty while prevReport still points at the previous task. This new task branch then treats the route change as a task removal and calls navigateAwayFromReport() with the old task's parent, hijacking navigation away from the report the user just opened; the deletion hook already has route-change protection, so the task case should also require an actual removal of the current route's report (e.g. wasReportRemoved) before redirecting.
Useful? React with 👍 / 👎.
A retarget to a report whose Onyx value has not loaded yet left prevReport pointing at the previous task, which read as a removal and redirected away from the report the user had just opened.
|
@MobileMage I approved the alternative solution, so let's go with that |
|
@bernhardoj Valforte said the inheritance covers any type except |
Yes, what you are doing right now is the opposite. The BE intentionally set the |
The backend intentionally gives a task its parent's chatType, so stripping it in getChatType fought that contract. isChatThread only matches type CHAT, which let a task off a group chat read as the root group chat; excluding via isThread covers it and leaves the inherited chatType intact. Also reverts the ReportNavigateAwayHandler change, which was only needed while getChatType stopped returning the inherited type.
| }); | ||
| }); | ||
|
|
||
| describe('task chatType classification (#96421)', () => { |
There was a problem hiding this comment.
We already have isRootGroupChat test cases in ReportUtilsTest.ts. Let's add more to that instead of creating a new one.
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp |
|
@MobileMage we can simplify the test steps to just create a task in a group chat, open it, open the task report details and verify there is no Leave option. |
| expect(isRootGroupChat(report)).toBe(false); | ||
| }); | ||
|
|
||
| it('should return false if the report is a task off an #admins room', () => { |
There was a problem hiding this comment.
We don't touch anything with the admins room type, so let's remove this.
| parentReportActionID: '67890', | ||
| }; | ||
|
|
||
| expect(isGroupChat(report)).toBe(true); |
There was a problem hiding this comment.
We are testing isRootGroupChat here, so let's remove this.
|
|
||
| it('should return false if the report is a task off a group chat', () => { | ||
| // The backend gives a task its parent's chatType, so this task reads as a group chat. It is | ||
| // still a thread off that chat, and `isChatThread` misses it because a task is not type CHAT. |
There was a problem hiding this comment.
I think this comment isn't needed. We already explain it in the function itself. Let's remove it.
|
|
||
| it('should return false for a task off a group chat', () => { | ||
| // A task inherits the parent group chat's chatType, but leaving it would run the | ||
| // destructive group-chat path, so the Leave row must stay hidden. See #96421. |
There was a problem hiding this comment.
Let's remove this whole comment too. (Note: it's advisable not to leave an issue number/link in a comment)
bernhardoj
left a comment
There was a problem hiding this comment.
Left some NAB comments above
|
Thanks @bernhardoj , I'm fixing those now |
|
🚧 Valforte has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/Valforte in version: 9.4.48-0 🚀
|
|
🤖 No help site changes required. This PR is an internal bug fix, not a user-facing feature or workflow change. It swaps one exclusion in Why no docs update is needed
@MobileMage, no linked help site PR was created since no |
|
🚀 Deployed to production by https://github.com/arosiclair in version: 9.4.48-3 🚀
Bundle Size Analysis (Sentry): |




Explanation of Change
When an assignee opens a task created inside a group chat, the backend returns the task report carrying the parent group chat's
chatType(for examplegroup). That inheritance is intentional, butisRootGroupChatexcluded threads usingisChatThread, which requirestype === CHAT. A task's type isTASK, so it slipped past the exclusion and read as the root group chat.Once the task counts as a root group chat,
canLeaveChatreturns true, so a Leave row shows on the task details page, andleaveChatruns the destructiveleaveGroupChatinstead ofleaveRoom.leaveGroupChatnulls the report'sreportID; the focused details RHP wraps inwithReportOrNotFound, whose gate flips toshouldShowNotFoundPagethe momentreportIDgoes null, so the page renders the full "Not here" screen before the deferred dismissal moves the user away.This PR swaps that one exclusion to
isThread, which is type-agnostic, so a task off a group chat is no longer the root group chat. The inheritedchatTypeis left untouched, matching the backend.canLeaveChatthen returns false for the task, the Leave row disappears, and the destructive path becomes unreachable. Unit tests cover this intests/unit/ReportUtilsTest.ts.Fixed Issues
$ #96421
PROPOSAL: #96421 (comment)
Tests
Offline tests
No offline-specific behavior. The classification reads local Onyx data only.
QA Steps
Same as Tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Videos will be added in a few hours.
Android: Native
97019-android-native.mp4
Android: mWeb Chrome
97019-android-mweb.mp4
iOS: Native
97019-ios-native.mp4
iOS: mWeb Safari
97019-ios-mweb.mp4
MacOS: Chrome / Safari
97019-macos-chrome.mp4