mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-18 07:36:00 +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`
|
`${logId}: expected GroupV2 conversation when not direct`
|
||||||
);
|
);
|
||||||
|
|
||||||
const shouldSend = shouldSendToConversation(conversation, jobLog);
|
const shouldSend = shouldSendToConversation(conversation, {
|
||||||
|
log: jobLog,
|
||||||
|
});
|
||||||
if (!shouldSend) {
|
if (!shouldSend) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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({
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export async function sendSenderKeyDistribution(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shouldSendToConversation(conversation, log)) {
|
if (!shouldSendToConversation(conversation, { log })) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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`
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user