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`
);
const shouldSend = shouldSendToConversation(conversation, jobLog);
const shouldSend = shouldSendToConversation(conversation, {
log: jobLog,
});
if (!shouldSend) {
return;
}

View File

@@ -242,7 +242,9 @@ export async function sendPollVote(
urgent: true,
});
} else {
const shouldSend = shouldSendToConversation(conversation, jobLog);
const shouldSend = shouldSendToConversation(conversation, {
log: jobLog,
});
if (!shouldSend) {
setMessagePollVoteFailed(pollMessage, currentPendingVote);
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.
if (!shouldSendToConversation(conversation, log)) {
if (!shouldSendToConversation(conversation, { log })) {
return;
}

View File

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

View File

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

View File

@@ -16,8 +16,12 @@ type ConversationForDirectSendType = Pick<
export function shouldSendToConversation(
conversation: ConversationModel,
log: LoggerType
options: {
log: LoggerType;
shouldSendToTerminatedGroups?: boolean;
}
): boolean {
const { log, shouldSendToTerminatedGroups = false } = options;
const recipients = getRecipients(conversation.attributes);
const untrustedServiceIds = getUntrustedConversationServiceIds(recipients);
@@ -42,7 +46,7 @@ export function shouldSendToConversation(
return false;
}
if (conversation.get('terminated')) {
if (!shouldSendToTerminatedGroups && conversation.get('terminated')) {
log.info(
`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 =
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;
let storyContextLogId = 'no storyContext';
if (storyContext) {