mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-31 18:02:27 +00:00
dm: make a selected recipient the active conversation in the right pane
Clicking "Message" added the user to the sidebar list but the right-hand message pane stayed on the previously-active conversation. setDirectMessageRecipient called setFocusedDmConversation (which only tracks read-state) and never set activeDmConversationId — the value buildDmConversationData reads to choose which thread the right pane renders — so it kept resolving the stale id. Set activeDmConversationId directly (mirroring handleDmConversationSelect), and switch the mobile pane to the thread for explicit selections (not the auto thread-default). Regression: tests/ui/dm-set-recipient-active.test.mjs. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
ebea4434de
commit
ab68ba51d0
2 files changed
+107
-4
No files matched your search
@@ -242,15 +242,24 @@ export class ProfileDirectMessageController {
|
||||
this.updateMessageThreadSelection(nextRecipient);
|
||||
|
||||
if (nextRecipient) {
|
||||
// Focus this recipient's conversation so a freshly-selected recipient
|
||||
// (e.g. the "Message" button for someone with no existing thread) isn't
|
||||
// overridden by a stale activeDmConversationId pointing at the top of the
|
||||
// inbox.
|
||||
// Make this recipient's conversation the active one so a freshly-selected
|
||||
// recipient (e.g. the "Message" button for someone with no existing
|
||||
// thread) isn't overridden by a stale activeDmConversationId pointing at
|
||||
// the top of the inbox. setFocusedDmConversation only tracks read-state —
|
||||
// activeDmConversationId is what buildDmConversationData reads to decide
|
||||
// which thread the right-hand pane renders, so set it directly (mirroring
|
||||
// handleDmConversationSelect).
|
||||
const actor = this.helper.resolveActiveDmActor();
|
||||
const conversationId = actor
|
||||
? this.helper.buildDmConversationId(actor, nextRecipient)
|
||||
: "";
|
||||
if (conversationId) {
|
||||
this.activeDmConversationId = conversationId;
|
||||
// Selecting a recipient explicitly (not the auto thread-default) means
|
||||
// the user wants to see that thread — switch the mobile pane to it too.
|
||||
if (reason !== "thread-default") {
|
||||
this.dmMobileView = "thread";
|
||||
}
|
||||
this.setFocusedDmConversation(conversationId);
|
||||
}
|
||||
void this.helper.ensureDmRecipientData(nextRecipient);
|
||||
|
||||
Reference in new issue
Block a user