Skip to content

Keep a manual unread mark on the chat that is already open (#3114) - #3204

Merged
Birfy merged 1 commit into
mainfrom
dev/3114-manual-unread-open
Nov 19, 2026
Merged

Birfy merged 1 commit into
mainfrom
dev/3114-manual-unread-open

Conversation

@Birfy

@Birfy Birfy commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Written-by: Dev
Fixes #3202
Owner: Dev
Reviewer: Reviewer
Part of #3114
Tier: T1

What

A manual Mark as Unread on the chat already on screen is cleared by useMarkedUnread in the same draw that sets it, because active is already true. The hook now keeps the previous active in a ref and clears only on the way back in.

Checkpoint

{
"pr": 3204,
"claim": "Dev",
"issue": 3202,
"summary": "useMarkedUnread now remembers whether the row was active on the previous draw and calls clearUnread only when a marked chat is opened. A manual Mark as Unread made on the chat already on screen therefore keeps its mark while that chat stays open, and the mark is cleared once when the chat is left and opened again. The unread dot and 'Unread activity' label still draw only when the row is not active, and the unread filter still reads the mark itself.",
"files": [
"core/src/client/sidebar.js",
"core/test/sidebar-manual-unread.test.js",
"docs/subsystems/core-client.md",
"changelog.d/3114-manual-unread-open.fixed.md",
"core/client.js",
"patches/ds-bot/0003-flybot-api-client.patch",
"patches/ds-bot/0008-client-bundle.patch",
"patches/ds-bot/files/test/sidebar-manual-unread.test.js"
],
"checks": {
"ran": "TZ=UTC TMPDIR=/data/flybot-tmp npm run verify (exit 0); cd core && node --test test/sidebar-session-filter.test.js test/sidebar-manual-unread.test.js test/context-menu-readonly.test.js test/client-bundle.test.js (13/13); node core/scripts/build-client.mjs --check; node scripts/ds-bot-patches.mjs check && canonical",
"result": "green",
"at": "0f4128c7098005e0a858189477045ec346b8eb3f"
},
"next": "none — ready for review. T1: green tests-ok at the tip is the gate; Dev writes no Verdict."
}

Verification at the tip

Tip: 0f4128c7098005e0a858189477045ec346b8eb3f.

Ran:

  • cd core && TZ=UTC TMPDIR=/data/flybot-tmp node --test test/sidebar-manual-unread.test.js — 3 tests / 3 pass / 0 fail after the change; 3 / 1 / 2 before it (red first).
  • cd core && TZ=UTC TMPDIR=/data/flybot-tmp node --test test/sidebar-session-filter.test.js test/sidebar-manual-unread.test.js test/context-menu-readonly.test.js test/client-bundle.test.js — 13 tests / 13 pass / 0 fail.
  • node core/scripts/build-client.mjs --check — exit 0 on the committed core/client.js.
  • node scripts/ds-bot-patches.mjs check — 10 patches apply cleanly, core/ equals ds-bot/ + patches/ds-bot/; canonical — generate is a no-op.
  • node .github/scripts/changelog.mjs check — 10 fragments well formed; node .github/scripts/check-mojibake.mjs --check — 0 occurrences.
  • TZ=UTC TMPDIR=/data/flybot-tmp npm run verify — exit 0.

Not run:

Red first

The three cases in core/test/sidebar-manual-unread.test.js ran before the implementation change:

# tests 3 / # pass 1 / # fail 2
not ok 1 - #3114: a mark made on the chat already on screen stays while it stays open
  the open chat mark was cleared while it stayed open
  actual: ['writer'] / expected: []
not ok 3 - #3114: leaving and coming back clears the mark that was made while the chat was open
  the mark is cleared on the way back in, not while open
  actual: ['writer','writer'] / expected: ['writer']
ok 2 - #3114: opening a chat that was already marked unread clears the mark once

The second case already passes on the old code; it is the no-regression case. After the change the same command reports 3 / 3 / 0.

Scope

Four handwritten files (+138/−4 = 142 lines) and four generated ones: core/client.js (+5/−2, 24759 → 24762), patches/ds-bot/0003-flybot-api-client.patch, patches/ds-bot/0008-client-bundle.patch, and the files/ mirror of the new test. patches/ds-bot/topics.json is untouched. No new i18n key: Mark as Unread already exists, and git diff main -- core/src/client/i18n.js is empty.

Ordering with #3112

#3112 is still open, not merged. It carries the same wasActive hunk in core/src/client/sidebar.js; when it merges after this one it must rebase and delete that hunk from sidebar.js, keeping core/src/shared/session-unread.js and its tests.

useMarkedUnread cleared the mark in the same pass that made it: `active` was
already true when the row re-rendered with `marked`, so Mark as Unread on the
chat on screen went away at once. Remember the previous `active` in a ref and
clear only on the way back in, so the mark survives while that chat stays open
and is cleared once when it is left and opened again.
@Birfy Birfy added the agent-pr Pull request opened by an agent label Nov 19, 2026
@Birfy Birfy self-assigned this Nov 19, 2026
@Birfy
Birfy marked this pull request as ready for review November 19, 2026 03:15
@Birfy
Birfy added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit eec113d Nov 19, 2026
20 of 21 checks passed
@Birfy
Birfy deleted the dev/3114-manual-unread-open branch November 19, 2026 03:41
@github-actions github-actions Bot removed the agent-pr Pull request opened by an agent label Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[#3114] 侧栏手动未读:在已打开会话上「Mark as Unread」当场被清掉,应到离开再回来时才清

1 participant