Skip to content

Show a thread as unread in the LHN when you mark your own message as unread - #104289

Merged
JS00001 merged 2 commits into
mainfrom
claude-markOwnThreadUnreadInLHN
Nov 3, 2026
Merged

JS00001 merged 2 commits into
mainfrom
claude-markOwnThreadUnreadInLHN

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

When you mark your own message as unread in a report where nobody else has written (for example, a new thread), the LHN row doesn't turn bold.

markCommentAsUnread rolls lastReadTime back correctly, but it can only pick another person as lastActorAccountID if someone else wrote in the report. Otherwise the current user stays the last actor, and isUnread returns false because of its "last actor is me" rule.

This PR makes isUnread skip that rule when report.manuallyMarkedUnreadReportActionID is set. markCommentAsUnread already sets that field optimistically. The rule still applies in every other case, so your own sent messages still don't make a report unread.

The change can't leave a report stuck as unread:

  • Reading the report (readNewestAction) and sending a message both move lastReadTime forward, so isUnreadFromTimestamp goes back to false even while the marker is still set.
  • openReport clears the marker when you return to the report or refresh.

Tests:

  • Adds unit tests for isUnread: own message without the marker (read), own message with the marker (unread), marker set after the report was read again (read), and another user's message with the marker (unread, unchanged).
  • Makes two existing test blocks set their own session instead of depending on the session that earlier tests leave behind. isUnread compares the last actor with the session account. findLastAccessedReport needs the session account to be a participant of its fake reports.

Limitation: this fixes the device where you mark the message. Other devices get lastActorAccountID from the server's MarkAsUnread response, so they may still show the row as read.

AI tests run locally:

  • npm test -- tests/unit/ReportUtilsTest.ts: passed, 1488/1488. The new "own message with the marker" test fails without the source change.
  • npm test on SidebarUtilsTest, SidebarTest, SidebarOrderTest, UnreadIndicatorsTest, and actions/ReportTest: passed.
  • npm run typecheck, npm run lint-changed, npm run spell-changed: passed.
  • I couldn't run the oxfmt format check in this environment. The changed lines are within the 190-character print width.
  • I tried a manual web check, but the test browser was stuck on a blank page, so I couldn't verify this in the UI.

Fixed Issues

$ #103759
PROPOSAL: #103759 (comment)

Tests

  1. Open a 1:1 chat where the other person has already sent a message.
  2. On your own latest message, choose Reply in thread and send one reply. Leave the thread with only your messages.
  3. In that thread, mark your reply as unread.
  4. Confirm the thread row in the LHN turns bold. The 1:1 row stays as it was.
  5. Open a different chat, then look at the LHN again. Confirm the thread row is still bold.
  6. Open the thread again. Confirm the thread row returns to regular weight.
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

  1. Open a 1:1 chat where the other person has already sent a message.
  2. On your own latest message, choose Reply in thread and send one reply. Leave the thread with only your messages.
  3. In that thread, mark your reply as unread.
  4. Confirm the thread row in the LHN turns bold. The 1:1 row stays as it was.
  5. Open a different chat, then look at the LHN again. Confirm the thread row is still bold.
  6. Open the thread again. Confirm the thread row returns to regular weight.
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

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

…age as unread

Co-authored-by: Roji Philip <rojiphil@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team October 17, 2026 02:45
@melvin-bot melvin-bot Bot added Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web labels Oct 17, 2026
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I created this PR from an upstream branch since I don't have push access to your fork.

To take ownership of this branch and be able to push updates, run:

git remote add upstream https://github.com/Expensify/App.git
git fetch upstream claude-markOwnThreadUnreadInLHN
git checkout -b claude-markOwnThreadUnreadInLHN upstream/claude-markOwnThreadUnreadInLHN
git push -u origin claude-markOwnThreadUnreadInLHN

Then you can close this PR and open a new one from your fork.

@MelvinBot

MelvinBot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ⚠️ partial

The PR's Tests section is still a TODO, so I used the repro steps from the linked issue. Creating a 1:1 chat passed, and so did the regression check (your own sent message does not bold the row). I could not verify the thread and "Mark as unread" steps (2–5). The web test harness can't hover, right-click, or long-press, so it couldn't open the message context menu. Those steps are unverified, not failures of the fix.
LHN after navigating away; lhnpeer chat row is not bold

Step Status
1. Open a 1:1 chat and send a message; the chat appears in the LHNStarted a chat with melvinbottestuser+lhnpeer@gmail.com and sent "Hello from Melvin test". The chat appeared in the LHN with the preview "You: Hello from Melvin test".
1:1 chat with lhnpeer showing sent message, present in LHN
✅
2. Create a thread on your own message and reply; the thread appears in the LHNBlocked by the test harness. Hovering the message never showed the action toolbar, across many hover attempts and two viewport sizes, so "Reply in thread" was unreachable. No thread was created.
Hovering over the message reveals no toolbar
❌
3. Mark your own thread reply as unread and navigate away; the thread's LHN row is boldNot verified. This step depends on step 2. The harness also returned UNSUPPORTED_OPERATION for right-click and long-press on web, so "Mark as unread" was unreachable.
❌
4. Reopen the thread; the LHN row is no longer boldNot verified. This step depends on steps 2 and 3.
❌
5. Mark your own parent message in the 1:1 chat as unread and navigate away; the chat's LHN row is boldNot verified. The same context-menu limitation as step 3 applies.
❌
6. Regression: send a new message yourself (without marking it unread) and navigate away; the LHN row is not boldSent "Second message without marking unread" in the lhnpeer chat, then opened a different chat. The lhnpeer LHN row was not bold, as expected.
LHN after navigating away; lhnpeer chat row is not bold
✅
7. No new JS console errorsThe web harness can't read the browser console. Instead, the tester checked network traffic. Every API call (OpenReport, AddComment, Search, OpenHomePage, AuthenticatePusher, Ping) returned 200, and none failed.
✅

view run · view recording

@MelvinBot

MelvinBot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Android test steps verification results: ✅ pass

On standalone Android NewDot, marking your own message as unread (in a thread or a 1:1 chat) now bolds that LHN row, and reading it again removes the bold. Sending your own message without marking it unread leaves the row non-bold, and no JS errors or crash screens appeared. The PR's Tests section is still a TODO, so these steps come from the linked issue's repro steps.
Self-sent message chat row remains non-bold

Step Status
1. Open a 1:1 chat and send a message; the chat appears in the LHNStarted a chat with melvinbottestuser+lhnpeer@gmail.com and sent a message. The chat row appeared in the Inbox LHN.
New 1:1 chat appears in Inbox LHN
✅
2. Reply in thread on your own message; the thread appears in the LHNThe thread row "Hello from the thread unread test / You: This is a thread reply" appeared in the Inbox LHN above the parent chat.
Thread reply appears in Inbox LHN
✅
3. Mark your own thread reply as unread; the thread's LHN row is boldThe row's accessibility label now includes "Unread", and the Unread filter badge shows 1. The thread row is bold while the other rows are not.
Thread row bold after marking own reply unread
✅
4. Reopen the thread and go back; the LHN row is no longer boldThe label no longer includes "Unread", the Unread badge is gone, and the row is back to regular weight.
Thread row no longer bold after re-reading
✅
5. Mark your own parent message in the 1:1 chat as unread; the chat's LHN row is boldThe label now includes "Unread", and the badge shows 1. The 1:1 chat row is bold while the other rows are not.
1:1 chat row bold after marking own parent message unread
✅
6. Regression: send your own message without marking it unread; the LHN row is not boldSent a new message in the 1:1 chat and returned to the Inbox. The label has no "Unread", the badge is absent, and the row is not bold.
Self-sent message chat row remains non-bold
✅
7. No new JS errors or red error screensNo crash dialogs or red error screens appeared at any point in the flow.
✅

view run · view recording

@rojiphil

rojiphil commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot Please merge with the latest main

…nreadInLHN

Co-authored-by: Roji Philip <rojiphil@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I merged the latest main into this branch with no conflicts and pushed it as 6586337.

I couldn't run the unit tests locally, so CI will check them.

@rojiphil

rojiphil commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot Tidy the tests/QA sections with the following test steps.

Steps:

  1. Open a 1:1 chat where the other person has already sent a message.
  2. On your own latest message, choose Reply in thread and send one reply. Leave the thread with only your messages.
  3. In that thread, mark your reply as unread.
  4. Confirm the thread row in the LHN turns bold. The 1:1 row stays as it was.
  5. Open a different chat, then look at the LHN again. Confirm the thread row is still bold.
  6. Open the thread again. Confirm the thread row returns to regular weight.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I updated the Tests and QA Steps sections with your six steps and removed the TODO placeholders. Both sections still include the JS console check.

I didn't change the Offline tests section. It's still empty.

@rojiphil

rojiphil commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
104289-android-hybrid-001.mp4
Android: mWeb Chrome
104289-mweb-chrome-001.mp4
iOS: HybridApp
104289-ios-hybrid-001.mp4
iOS: mWeb Safari
104289-mweb-safari-001.mp4
MacOS: Chrome / Safari
104289-web-chrome-001.mp4

@rojiphil

rojiphil commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot Please tick the boxes in the PR Author Checklist section as I have already verified these in PR Reviewer Checklist as a co-author

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I ticked all 36 boxes in the PR Author Checklist, based on your Reviewer Checklist. I didn't change anything else in the PR description.

Two of the ticked items point to sections that are still empty:

  • Offline tests: this section has no steps yet.
  • Screenshots/Videos: your videos are in your reviewer comment, not in the PR description.

The four accessibility items and the High Traffic account item have no matching line in the reviewer checklist. Uncheck any that don't apply.

@rojiphil

rojiphil commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot Please mark the PR as ready for review.

@MelvinBot
MelvinBot marked this pull request as ready for review November 3, 2026 01:55
@MelvinBot
MelvinBot requested a review from a team as a code owner November 3, 2026 01:55
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I marked this PR as ready for review.

@melvin-bot
melvin-bot Bot requested review from rojiphil and removed request for a team November 3, 2026 01:55
@melvin-bot

melvin-bot Bot commented Nov 3, 2026

Copy link
Copy Markdown

@rojiphil 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]

@melvin-bot
melvin-bot Bot requested a review from heyjennahay November 3, 2026 01:55
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T02:00:56.983579Z 6586337 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@melvin-bot
melvin-bot Bot removed the request for review from a team November 3, 2026 01:55

@rojiphil rojiphil left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JS00001 Changes LGTM.
Approving for your review. Thanks.

@melvin-bot
melvin-bot Bot requested a review from JS00001 November 3, 2026 01:59

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 658633792e

ℹ️ 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".

Comment thread src/libs/ReportUtils.ts
if (isUnreadFromTimestamp && drivingActorAccountID === deprecatedCurrentUserAccountID && !(lastReadTime < lastMentionedTime)) {
// A manual mark-as-unread wins over the "last actor is me" rule, so a report where only the current user has written
// (e.g. a new thread) still shows as unread. Reading the report moves lastReadTime forward, so this can't stick.
if (isUnreadFromTimestamp && drivingActorAccountID === deprecatedCurrentUserAccountID && !(lastReadTime < lastMentionedTime) && !report.manuallyMarkedUnreadReportActionID) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Expire the manual override after its anchor is read

When readNewestAction() advances lastReadTime, it deliberately leaves manuallyMarkedUnreadReportActionID set until a return trip or refresh. While that stale marker remains, any later self-authored action whose lastVisibleActionCreated arrives after lastReadTime—for example, through a delayed server update or another device—now bypasses the last-actor guard and makes the LHN row unread again. The marker only proves that an action was marked previously, not that the current timestamp gap belongs to that action; expire the override after its anchor is read or verify that the unread gap still corresponds to the marked action.

Useful? React with 👍 / 👎.

@JS00001
JS00001 merged commit 5b8d332 into main Nov 3, 2026
54 of 57 checks passed
@JS00001
JS00001 deleted the claude-markOwnThreadUnreadInLHN branch November 3, 2026 14:36
@OSBotify

OSBotify commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🚧 JS00001 has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@OSBotify OSBotify mentioned this pull request Nov 3, 2026
99 tasks done
@OSBotify

OSBotify commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/JS00001 in version: 9.5.31-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 failure ❌
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor Author

No help site update needed. This bug fix makes marking your own message as unread display the expected bold chat row; it adds no workflow and makes no existing article incorrect.

@OSBotify

OSBotify commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/JS00001 in version: 9.5.31-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@OSBotify

OSBotify commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/blimpich in version: 9.5.31-4 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants