diff --git a/package.json b/package.json index 700e001..dcba20c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "skate-spots", "private": true, - "version": "1.2.41", + "version": "1.2.42", "type": "module", "homepage": "https://skate-spots.com", "scripts": { diff --git a/src/hooks/useDirectMessages.ts b/src/hooks/useDirectMessages.ts index f63f235..ca2f170 100644 --- a/src/hooks/useDirectMessages.ts +++ b/src/hooks/useDirectMessages.ts @@ -322,6 +322,12 @@ export function useConversation(otherPubkey: string) { // Check if this message is part of the conversation with otherPubkey const pTags = rumor.tags.filter(t => t[0] === 'p').map(t => t[1]); + + // 1:1 only. A rumor with more than one recipient is a GROUP message + // (handled by useGroupConversation). Without this guard a group chat + // leaks into the 1:1 thread with each of its participants. + if (pTags.length > 1) continue; + const isFromOther = rumor.pubkey === otherPubkey; const isToOther = pTags.includes(otherPubkey); const isFromMe = rumor.pubkey === user.pubkey; @@ -428,6 +434,13 @@ export function useConversations() { // Determine conversation partner const pTags = rumor.tags.filter(t => t[0] === 'p').map(t => t[1]); + + // 1:1 list only. A rumor addressed to more than one recipient is a + // GROUP message (surfaced by useGroupConversations). Without this + // guard each group would masquerade as a phantom 1:1 with whichever + // participant happened to speak, and would appear twice in the UI. + if (pTags.length > 1) continue; + let conversationWith: string; if (rumor.pubkey === user.pubkey) {