Share profile key: Cancel send in more situations
This commit is contained in:
parent
57eed10a38
commit
86e92dda51
2 changed files with 45 additions and 13 deletions
|
@ -301,6 +301,13 @@ export class ConversationJobQueue extends JobQueue<ConversationQueueJobData> {
|
|||
verificationData.type ===
|
||||
ConversationVerificationState.PendingVerification
|
||||
) {
|
||||
if (type === conversationQueueJobEnum.enum.ProfileKey) {
|
||||
log.warn(
|
||||
"Cancelling profile share, we don't want to wait for pending verification."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
log.info(
|
||||
'verification is pending for this conversation; waiting at most 5m...'
|
||||
);
|
||||
|
@ -426,9 +433,17 @@ export class ConversationJobQueue extends JobQueue<ConversationQueueJobData> {
|
|||
}
|
||||
|
||||
if (untrustedUuids.length) {
|
||||
if (type === jobSet.ProfileKey) {
|
||||
log.warn(
|
||||
`Cancelling profile share, since there were ${untrustedUuids.length} untrusted send targets.`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
log.error(
|
||||
`Send failed because ${untrustedUuids.length} conversation(s) were untrusted. Adding to verification list.`
|
||||
);
|
||||
|
||||
window.reduxActions.conversations.conversationStoppedByMissingVerification(
|
||||
{
|
||||
conversationId: conversation.id,
|
||||
|
|
|
@ -32,6 +32,8 @@ import {
|
|||
SendMessageProtoError,
|
||||
UnregisteredUserError,
|
||||
} from '../../textsecure/Errors';
|
||||
import { getRecipients } from '../../util/getRecipients';
|
||||
import { getUntrustedConversationUuids } from './getUntrustedConversationUuids';
|
||||
|
||||
export function canAllErrorsBeIgnored(
|
||||
conversation: ConversationAttributesType,
|
||||
|
@ -102,27 +104,34 @@ export async function sendProfileKey(
|
|||
|
||||
// Note: flags and the profileKey itself are all that matter in the proto.
|
||||
|
||||
// Note: we don't check for untrusted conversations here; we attempt to send anyway
|
||||
const recipients = getRecipients(conversation.attributes);
|
||||
const untrustedUuids = getUntrustedConversationUuids(recipients);
|
||||
if (untrustedUuids.length) {
|
||||
log.info(
|
||||
`conversation ${conversation.idForLogging()} has untrusted recipients; refusing to send`
|
||||
);
|
||||
}
|
||||
|
||||
if (!isConversationAccepted(conversation.attributes)) {
|
||||
log.info(
|
||||
`conversation ${conversation.idForLogging()} is not accepted; refusing to send`
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (conversation.isBlocked()) {
|
||||
log.info(
|
||||
`conversation ${conversation.idForLogging()} is blocked; refusing to send`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isDirectConversation(conversation.attributes)) {
|
||||
if (!isConversationAccepted(conversation.attributes)) {
|
||||
log.info(
|
||||
`conversation ${conversation.idForLogging()} is not accepted; refusing to send`
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (isConversationUnregistered(conversation.attributes)) {
|
||||
log.info(
|
||||
`conversation ${conversation.idForLogging()} is unregistered; refusing to send`
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (conversation.isBlocked()) {
|
||||
log.info(
|
||||
`conversation ${conversation.idForLogging()} is blocked; refusing to send`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const proto = await messaging.getContentMessage({
|
||||
flags: Proto.DataMessage.Flags.PROFILE_KEY_UPDATE,
|
||||
|
@ -144,6 +153,14 @@ export async function sendProfileKey(
|
|||
log.error('No revision provided, but conversation is GroupV2');
|
||||
}
|
||||
|
||||
const ourUuid = window.textsecure.storage.user.getCheckedUuid();
|
||||
if (!conversation.hasMember(ourUuid)) {
|
||||
log.info(
|
||||
`We are not part of group ${conversation.idForLogging()}; refusing to send`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const groupV2Info = conversation.getGroupV2Info();
|
||||
if (groupV2Info && isNumber(revision)) {
|
||||
groupV2Info.revision = revision;
|
||||
|
|
Loading…
Reference in a new issue