Repository navigation
feat(conversation): add tdc conversation mark-unread - #148
Merged
scottlovegrove merged 3 commits intoDec 4, 2026
Merged
scottlovegrove merged 3 commits into
scottlovegrove merged 3 commits into
Conversation
doistbot
reviewed
Dec 4, 2026
doistbot
left a comment
Member
There was a problem hiding this comment.
Adds tdc conversation mark-unread on the shared read-state runner, mirroring the thread version's options and guards while intentionally defaulting to marking the latest message unread — no inline issues were flagged.
I also included a few optional follow-up notes in the details below.
Optional follow-up notes (2)
src/commands/conversation/mark-unread.ts:77:
resolveFromObjIndexis a near-verbatim copy of the one insrc/commands/thread/unread.ts— same ref parsing, same twoINVALID_REFchecks with reworded messages, sametypeof objIndex !== 'number'guard — differing only in the lookup call (conversationMessages.getMessagevscomments.getComment), the parent field (conversationIdvsthreadId), and the final index adjustment. This is now the second copy, so it's worth folding into one helper (e.g. insrc/lib/read-state.ts) parameterized by the lookup, parent field, noun for the messages, and an optional index offset. Not blocking.src/commands/conversation/conversation.test.ts:2274: There's no test for a
--frommessage that has noobjIndex, althoughmarkConversationUnread's resolver has an explicitINVALID_REFguard for it. If that guard regressed,firstUnreadwould fall back tolastObjIndexand silently mark the latest message unread while printing "from message M5". Add a sibling test with a message whoseobjIndexis undefined (asthread mark-unreaddoes for the equivalent comment guard), asserting theINVALID_REFerror and thatmarkUnreadwas not called.
The inverse of `tdc conversation mark-read`, on the same read-state runner, with the options of `tdc thread mark-unread`: one or more refs (or --stdin), --yes for a bulk run, --dry-run, --json rows, and --from <message-ref> for a single conversation. A conversation's unread marker is its first unread message, so --from marks that message and everything after it unread. Without --from it marks the latest message unread, as "Mark unread" on a conversation does in the Comms app, rather than the whole history. The --json rows report lastReadObjIndex, the last message still read, as the thread rows do.
scottlovegrove
force-pushed
the
scottl/conversation-mark-unread
branch
from
December 4, 2026 14:49
cc8d0ef to
ef60218
Compare
scottlovegrove
requested review from
a team and
rmartins90
and removed request for
a team
December 4, 2026 15:03
doist-release-bot Bot
added a commit
that referenced
this pull request
Dec 4, 2026
## [6.1.0](v6.0.1...v6.1.0) (2026-12-04) ### Features * **conversation:** add tdc conversation mark-read ([#147](#147)) ([bda7dcf](bda7dcf)) * **conversation:** add tdc conversation mark-unread ([#148](#148)) ([c9c02e8](c9c02e8)) ### Bug Fixes * mark the thread or conversation read when replying ([#144](#144)) ([e061f51](e061f51))
Contributor
|
🎉 This PR is included in version 6.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
tdc conversation mark-unread, the inverse oftdc conversation mark-readfrom the PR below, on the same read-state runner and with the options oftdc thread mark-unread: one or more refs or--stdin,--yesfor a bulk run,--dry-run,--jsonrows, and--from <message-ref>for a single conversation.The default differs from the thread command on purpose. A conversation's unread marker is its first unread message (the backend's
mark_readmoves it to N+1, new messages set it to their own index, andmark_unreadrejects anything below 0). comms-web's "Mark unread" on a message sends that message's index, and "Mark unread" on a whole conversation sends the latest message's index, so only the newest message turns unread. This command does the same: without--fromit marks the latest message unread rather than sending the reader back to the start of what may be years of DM history; with--fromit marks that message and everything after it unread. A conversation already unread from that message or an earlier one is reported and left alone.The
--jsonrows are{ id, isRead: false, lastReadObjIndex }, wherelastReadObjIndexis the last message still read (-1when every message is unread), so the field means the same as in the thread rows.--fromchecks the message belongs to the conversation (INVALID_REFotherwise) and refuses more than one conversation (CONFLICTING_OPTIONS), as the thread version does.Checked against the real API with
--dry-runonly, with and without--from: the message lookup, the conversation check and the index all came back as expected. Nothing was actually marked unread.