mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-03 03:12:31 +00:00
dm: focus the selected recipient instead of the top conversation
Clicking "Message" on a profile (or selecting anyone you'd never DMed) set the
recipient, but buildDmConversationData discarded it: a recipient with no
existing thread wasn't in conversationMap, so it fell back to conversations[0]
(the top conversation). The inbox silently jumped to the top thread, and any
message sent then went to the wrong person ("says sent but I don't see it").
Fixes:
- setDirectMessageRecipient now focuses the selected recipient's conversation
so a stale activeDmConversationId can't win.
- buildDmConversationData synthesizes an empty conversation for a
selected-but-threadless recipient and treats it as active, including an
activeRemotePubkey fallback so the composer targets the right person.
- The legacy renderProfileMessages list no longer clobbers a non-null
recipient with threadsToRender[0].
Regression: tests/ui/dm-conversation-focus.test.mjs.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
4f7baa3e99
commit
d29287a580
5 files changed
+193
-11
No files matched your search
@@ -566,11 +566,14 @@ export class ProfileDirectMessageRenderer {
|
||||
}
|
||||
|
||||
const activeRecipient = this.controller.helper.resolveActiveDmRecipient();
|
||||
const hasActiveRecipient =
|
||||
activeRecipient &&
|
||||
threadsToRender.some((thread) => thread.remoteHex === activeRecipient);
|
||||
|
||||
if (threadsToRender.length && !hasActiveRecipient) {
|
||||
if (activeRecipient) {
|
||||
// Respect an explicitly-selected recipient even if it has no thread yet
|
||||
// (e.g. the "Message" button for someone you've never DMed). Defaulting
|
||||
// to threadsToRender[0] here is what made the inbox jump to the top
|
||||
// conversation instead of the person you chose.
|
||||
this.updateMessageThreadSelection(activeRecipient);
|
||||
} else if (threadsToRender.length) {
|
||||
this.controller.setDirectMessageRecipient(threadsToRender[0].remoteHex, {
|
||||
reason: "thread-default",
|
||||
});
|
||||
@@ -579,8 +582,6 @@ export class ProfileDirectMessageRenderer {
|
||||
threadsToRender[0].remoteHex,
|
||||
);
|
||||
this.controller.setFocusedDmConversation(conversationId);
|
||||
} else if (hasActiveRecipient) {
|
||||
this.updateMessageThreadSelection(activeRecipient);
|
||||
}
|
||||
|
||||
this.profileMessagesList.classList.remove("hidden");
|
||||
|
||||
Reference in new issue
Block a user