Repository navigation
fix: Thread-Infinite Loading Occurs When Replying to a Deleted Parent Message - #61635
djordjemitrovic00 wants to merge 7 commits into
Conversation
|
@shubham1206agra 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] |
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
3795f91 to
49aa56b
Compare
|
@djordjemitrovic00 Please write the tests properly |
|
And please upload videos properly |
|
Hey, thanks for guidelines :)
I've just changed them following how other tests are written. I hope they are good now, but can you be a little bit more specific if they are not good enough? Or point me to some guidelines on how you write tests here?
Fixed, seems like no space before and after link doesnt embed it as video. |
|
Hey @shubham1206agra Can you please take a look and give me some feedback? Or any update if we are waiting for something? Thanks in advance |
|
Hey @francoisl Thanks for reaching out I created new PR with fresh changes, because after merging with main there was leftover unsigned commit which I cant amend without rebasing all commits. You can take a look |

Explanation of Change
Previously, we only checked whether the isDeletedParentAction flag was set to true to determine if a chat thread was deleted. However, we should introduce a utility function called isChatThreadDeleted in ReportUtils.ts that also checks whether the deleted property is null. If deleted is not null, we can treat the thread as deleted.
In the sidebar, "Deleted message" needs to be displayed instead of "Hidden" or empty message. In SidebarUtils.ts, this is handled through the reportName variable, which uses the getReportName function that now relies on our new isChatThreadDeleted function.
We can invoke the getReportAction function, providing report.parentReportActionID as the report action ID to retrieve the parent report action. From the parent report action, we can then extract the message and check for the presence of the deleted or isDeletedParentAction flags.
Additionally, when sending a message to a deleted thread, both the deleted and isDeletedParentAction flags may be missing from the message itself. Nevertheless, these flags are still available within reportAction.originalMessage. Consequently, we have also implemented a check for their presence in the originalMessage.
There is a useful function, IsDeletedMessage, located in ReportActionUtils.ts. By modifying it to check both the deleted and isDeletedParentAction flags on both the message and the originalMessage, we can reliably determine whether a message has actually been deleted. We can then reuse this improved function within the new isChatThreadDeleted function.
Furthermore, because a sent message is displayed as edited rather than deleted, we must adjust the way we retrieve message fragments. Specifically, a deleted chat thread scenario is identified when there is only a single message present in the message property. Therefore, an additional check for this condition has been incorporated when retrieving chat fragments within the getReportActionMessageFragments function.
With this approach, the HeaderView.tsx component will correctly display the title "Deleted message" instead of showing a loading skeleton.
Fixed Issues
$ #59392
$ PROPOSAL: #59392 (comment)
Tests
I checked tests that are related to those enhancements, and no tests were failing.
Created new unit tests for functions I changed. There was no tests for function IsMessageDeleted so I added tests for whole function.
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
We need 2 application instances and 2 users to test this.
User A initiate a new chat, and provide User B’s email address.
Send a message to User B in the direct conversation.
Sign in with User B to access the message thread.
Return to User A, locate the sent message, right-click on it, remove it.
Switch back to User B and post a reply in the same thread.
Observe the following issues:
The thread header gets stuck in a perpetual loading state. (Shouldn't happen)
The message appears to have been edited rather than deleted. (Should be deleted)
In the sidebar, the conversation is marked as “Hidden” instead of showing as a “Deleted” message. (should be deleted)
Verify that no errors appear in the JS console
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android.app.mp4
Android: mWeb Chrome
android.chrome.mp4
iOS: Native
ios.app.mp4
iOS: mWeb Safari
ios.chrome.mp4
MacOS: Chrome / Safari
mac.safari.mp4
MacOS: Desktop
mac.app.mp4