Fix sending receipts to terminated groups

Co-authored-by: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com>
This commit is contained in:
automated-signal
2026-04-01 11:47:31 -05:00
committed by GitHub
parent 65e80e0972
commit 3bfa150348
7 changed files with 29 additions and 16 deletions

View File

@@ -190,7 +190,9 @@ export async function sendPollTerminate(
`${logId}: expected GroupV2 conversation when not direct` `${logId}: expected GroupV2 conversation when not direct`
); );
const shouldSend = shouldSendToConversation(conversation, jobLog); const shouldSend = shouldSendToConversation(conversation, {
log: jobLog,
});
if (!shouldSend) { if (!shouldSend) {
return; return;
} }

View File

@@ -242,7 +242,9 @@ export async function sendPollVote(
urgent: true, urgent: true,
}); });
} else { } else {
const shouldSend = shouldSendToConversation(conversation, jobLog); const shouldSend = shouldSendToConversation(conversation, {
log: jobLog,
});
if (!shouldSend) { if (!shouldSend) {
setMessagePollVoteFailed(pollMessage, currentPendingVote); setMessagePollVoteFailed(pollMessage, currentPendingVote);
await window.MessageCache.saveMessage(pollMessage.attributes); await window.MessageCache.saveMessage(pollMessage.attributes);

View File

@@ -107,7 +107,7 @@ export async function sendProfileKey(
// Note: flags and the profileKey itself are all that matter in the proto. // Note: flags and the profileKey itself are all that matter in the proto.
if (!shouldSendToConversation(conversation, log)) { if (!shouldSendToConversation(conversation, { log })) {
return; return;
} }

View File

@@ -14,7 +14,12 @@ export async function sendReceipts(
{ log }: ConversationQueueJobBundle, { log }: ConversationQueueJobBundle,
data: ReceiptsJobData data: ReceiptsJobData
): Promise<void> { ): Promise<void> {
if (!shouldSendToConversation(conversation, log)) { if (
!shouldSendToConversation(conversation, {
log,
shouldSendToTerminatedGroups: true,
})
) {
return; return;
} }
await sendReceiptsTask({ await sendReceiptsTask({

View File

@@ -54,7 +54,7 @@ export async function sendSenderKeyDistribution(
return; return;
} }
if (!shouldSendToConversation(conversation, log)) { if (!shouldSendToConversation(conversation, { log })) {
return; return;
} }

View File

@@ -16,8 +16,12 @@ type ConversationForDirectSendType = Pick<
export function shouldSendToConversation( export function shouldSendToConversation(
conversation: ConversationModel, conversation: ConversationModel,
log: LoggerType options: {
log: LoggerType;
shouldSendToTerminatedGroups?: boolean;
}
): boolean { ): boolean {
const { log, shouldSendToTerminatedGroups = false } = options;
const recipients = getRecipients(conversation.attributes); const recipients = getRecipients(conversation.attributes);
const untrustedServiceIds = getUntrustedConversationServiceIds(recipients); const untrustedServiceIds = getUntrustedConversationServiceIds(recipients);
@@ -42,7 +46,7 @@ export function shouldSendToConversation(
return false; return false;
} }
if (conversation.get('terminated')) { if (!shouldSendToTerminatedGroups && conversation.get('terminated')) {
log.info( log.info(
`conversation ${conversation.idForLogging()} is terminated; refusing to send` `conversation ${conversation.idForLogging()} is terminated; refusing to send`
); );

View File

@@ -365,15 +365,6 @@ export async function handleDataMessage(
} }
} }
// Drop incoming messages to terminated groups
if (conversation.get('terminated')) {
log.warn(
`Received message for terminated group ${conversation.idForLogging()}. Dropping.`
);
confirm();
return;
}
const messageId = const messageId =
message.get('id') || generateMessageId(message.get('received_at')).id; message.get('id') || generateMessageId(message.get('received_at')).id;
@@ -406,6 +397,15 @@ export async function handleDataMessage(
); );
} }
// Drop incoming messages to terminated groups
if (conversation.get('terminated')) {
log.warn(
`Received message for terminated group ${conversation.idForLogging()}. Dropping.`
);
confirm();
return;
}
const { storyContext } = initialMessage; const { storyContext } = initialMessage;
let storyContextLogId = 'no storyContext'; let storyContextLogId = 'no storyContext';
if (storyContext) { if (storyContext) {