Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/commands/conversations/process-join-requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,17 @@ always-on usage).`;
// If we can't read appData, skip tag check but continue
}

// Scanning Allowed DMs means previously handled join requests come around
// again on every batch/catchup pass; an existing membership makes them a
// no-op instead of a re-add.
const existingMembers = await group.members();
if (existingMembers.some((m) => m.inboxId === message.senderInboxId)) {
this.log(
`${message.senderInboxId} already a member of ${conversationId} — skipping`,
);
return;
}

this.log(`Adding ${message.senderInboxId} to conversation ${conversationId}`);
await group.addMembers([message.senderInboxId]);

Expand Down Expand Up @@ -242,9 +253,12 @@ always-on usage).`;
if (sinceNs === 0n) return;
try {
await client.conversations.sync();
// Include Allowed DMs: a repeat joiner's request arrives on the DM that
// was consented during their first join. Scanning only Unknown DMs
// silently drops those requests, leaving the joiner stuck "verifying".
const dms = await client.conversations.list({
conversationType: ConversationType.Dm,
consentStates: [ConsentState.Unknown],
consentStates: [ConsentState.Unknown, ConsentState.Allowed],
});
for (const dm of dms) {
try {
Expand Down Expand Up @@ -313,9 +327,12 @@ always-on usage).`;
const allResults = [];
await client.conversations.sync();

// Include Allowed DMs: a repeat joiner's request arrives on the DM that
// was consented during their first join. Scanning only Unknown DMs
// silently drops those requests, leaving the joiner stuck "verifying".
const dms = await client.conversations.list({
conversationType: ConversationType.Dm,
consentStates: [ConsentState.Unknown],
consentStates: [ConsentState.Unknown, ConsentState.Allowed],
});

for (const dm of dms) {
Expand Down
Loading