fix: report unread#91940
Conversation
|
@ikevin127 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] |
|
@stitesExpensify 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] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7ba0daf181
ℹ️ 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".
| return lastReadTime < (lastVisibleActionCreated ?? '') || lastReadTime < lastMentionedTime; | ||
| const isUnreadFromTimestamp = lastReadTime < (lastVisibleActionCreated ?? '') || lastReadTime < lastMentionedTime; | ||
|
|
||
| if (isUnreadFromTimestamp && report.lastActorAccountID === deprecatedCurrentUserAccountID && !(lastReadTime < lastMentionedTime)) { |
There was a problem hiding this comment.
Preserve unread state for transaction-thread updates
This self-actor guard also runs when isUnreadFromTimestamp comes from oneTransactionThreadReport, because getReportLastVisibleActionCreated() compares both the parent report and one-transaction thread timestamps. In a one-transaction expense where the parent report's lastActorAccountID is the current user but a different user later adds a newer visible action in the transaction thread, this branch returns false based on the parent actor and hides a genuinely unread thread update from the LHN/report.
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| const lastReadTime = DateUtils.subtractMillisecondsFromDateTime(optimisticRejectReportAction.created, 1); | ||
| const lastReadTime = optimisticRejectReportAction.created; |
There was a problem hiding this comment.
Mark the reject comment timestamp as read
The optimistic reject flow sets lastVisibleActionCreated to optimisticRejectReportActionComment.created, which is one millisecond after optimisticRejectReportAction.created, so this still leaves lastReadTime < lastVisibleActionCreated. When rejecting someone else's request, the report can still have their lastActorAccountID because this merge does not update it, so the new self-authored guard does not apply and the user's own reject/comment remains unread; use the same timestamp as the visible comment or update the actor with it.
Useful? React with 👍 / 👎.
|
@annaweber830 If you can, please address the two code review comments from codex and reply to them on whether they have merit or not. If changes are needed as a result of any of the comments, once you push the changes, you can tag codex to verify that the issues were addressed via new comment typing: @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7ba0daf181
ℹ️ 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".
| return lastReadTime < (lastVisibleActionCreated ?? '') || lastReadTime < lastMentionedTime; | ||
| const isUnreadFromTimestamp = lastReadTime < (lastVisibleActionCreated ?? '') || lastReadTime < lastMentionedTime; | ||
|
|
||
| if (isUnreadFromTimestamp && report.lastActorAccountID === deprecatedCurrentUserAccountID && !(lastReadTime < lastMentionedTime)) { |
There was a problem hiding this comment.
Use the actor from the report that supplied the newest timestamp
When oneTransactionThreadReport.lastVisibleActionCreated is newer than the parent report, this check still looks only at the parent report.lastActorAccountID. In a one-transaction report where the parent’s last actor is the current user but the transaction thread has a newer message from someone else, isUnreadFromTimestamp is true but this returns false, hiding a real unread child-thread update. The self-authored suppression needs to compare against the actor belonging to whichever report provided the winning lastVisibleActionCreated timestamp.
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| const lastReadTime = DateUtils.subtractMillisecondsFromDateTime(optimisticRejectReportAction.created, 1); | ||
| const lastReadTime = optimisticRejectReportAction.created; |
There was a problem hiding this comment.
Mark reject comments read through the comment timestamp
The reject flow creates optimisticRejectReportActionComment one millisecond after optimisticRejectReportAction, then stores lastVisibleActionCreated from the comment but lastReadTime from the earlier action. If the thread’s previous lastActorAccountID is not the current user, isUnread() still sees lastReadTime < lastVisibleActionCreated and leaves the report unread after rejecting. Set lastReadTime to the comment action’s created time, or update the report actor consistently, so the self-authored reject comment is actually considered read.
Useful? React with 👍 / 👎.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
@annaweber830 Please tag me once the PR Author Checklist is completed (checkboxes checked, Testing steps and video proof for all platforms) and the Codex Review comments are addressed 🙌 |
Explanation of Change
Fix: Self-authored posts should never be marked as unread
Fixed Issues
$#91443
PROPOSAL:#91443 (comment)
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.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: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari