mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-02 08:13:37 +01:00
Fix sending receipts to terminated groups
Co-authored-by: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -54,7 +54,7 @@ export async function sendSenderKeyDistribution(
|
||||
return;
|
||||
}
|
||||
|
||||
if (!shouldSendToConversation(conversation, log)) {
|
||||
if (!shouldSendToConversation(conversation, { log })) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -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`
|
||||
);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user