Ensure consistent member filtering in sendToGroup
This commit is contained in:
parent
fe2007195b
commit
99c95794af
4 changed files with 39 additions and 7 deletions
|
@ -277,6 +277,12 @@ function getRecipients(
|
|||
if (!recipient) {
|
||||
return null;
|
||||
}
|
||||
if (recipient.isUnregistered()) {
|
||||
return null;
|
||||
}
|
||||
if (recipient.isBlocked()) {
|
||||
return null;
|
||||
}
|
||||
return recipient.get('uuid');
|
||||
})
|
||||
.filter(isNotNil);
|
||||
|
|
|
@ -35,23 +35,44 @@ export async function sendGroupUpdate(
|
|||
}: ConversationQueueJobBundle,
|
||||
data: GroupUpdateJobData
|
||||
): Promise<void> {
|
||||
const logId = `sendGroupUpdate/${conversation.idForLogging()}`;
|
||||
|
||||
if (!shouldContinue) {
|
||||
log.info('Ran out of time. Giving up on sending group update');
|
||||
log.info(`${logId}: Ran out of time. Giving up on sending group update`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isGroupV2(conversation.attributes)) {
|
||||
log.error(
|
||||
`Conversation ${conversation.idForLogging()} is not GroupV2, cannot send group update!`
|
||||
`${logId}: Conversation is not GroupV2, cannot send group update!`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
log.info(
|
||||
`Starting group update for ${conversation.idForLogging()} with timestamp ${timestamp}`
|
||||
);
|
||||
log.info(`${logId}: starting with timestamp ${timestamp}`);
|
||||
|
||||
const { groupChangeBase64, recipients, revision } = data;
|
||||
const { groupChangeBase64, recipients: jobRecipients, revision } = data;
|
||||
|
||||
const recipients = jobRecipients.filter(id => {
|
||||
const recipient = window.ConversationController.get(id);
|
||||
if (!recipient) {
|
||||
return false;
|
||||
}
|
||||
if (recipient.isUnregistered()) {
|
||||
log.warn(
|
||||
`${logId}: dropping unregistered recipient ${recipient.idForLogging()}`
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (recipient.isBlocked()) {
|
||||
log.warn(
|
||||
`${logId}: dropping blocked recipient ${recipient.idForLogging()}`
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
const untrustedUuids = getUntrustedConversationUuids(recipients);
|
||||
if (untrustedUuids.length) {
|
||||
|
@ -69,7 +90,6 @@ export async function sendGroupUpdate(
|
|||
const { ContentHint } = Proto.UnidentifiedSenderMessage.Message;
|
||||
const contentHint = ContentHint.RESENDABLE;
|
||||
const sendType = 'groupChange';
|
||||
const logId = `sendGroupUpdate/${conversation.idForLogging()}`;
|
||||
|
||||
const groupChange = groupChangeBase64
|
||||
? Bytes.fromBase64(groupChangeBase64)
|
||||
|
|
|
@ -430,6 +430,9 @@ function getMessageRecipients({
|
|||
if (recipient.isUnregistered()) {
|
||||
return;
|
||||
}
|
||||
if (recipient.isBlocked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const recipientIdentifier = recipient.getSendTarget();
|
||||
if (!recipientIdentifier) {
|
||||
|
|
|
@ -416,6 +416,9 @@ function getRecipients(
|
|||
if (recipient.isUnregistered()) {
|
||||
continue;
|
||||
}
|
||||
if (recipient.isBlocked()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
allRecipientIdentifiers.push(recipientIdentifier);
|
||||
if (!isRecipientMe) {
|
||||
|
|
Loading…
Add table
Reference in a new issue