Share profile key: Cancel send in more situations
This commit is contained in:
@@ -301,6 +301,13 @@ export class ConversationJobQueue extends JobQueue<ConversationQueueJobData> {
|
|||||||
verificationData.type ===
|
verificationData.type ===
|
||||||
ConversationVerificationState.PendingVerification
|
ConversationVerificationState.PendingVerification
|
||||||
) {
|
) {
|
||||||
|
if (type === conversationQueueJobEnum.enum.ProfileKey) {
|
||||||
|
log.warn(
|
||||||
|
"Cancelling profile share, we don't want to wait for pending verification."
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
log.info(
|
log.info(
|
||||||
'verification is pending for this conversation; waiting at most 5m...'
|
'verification is pending for this conversation; waiting at most 5m...'
|
||||||
);
|
);
|
||||||
@@ -426,9 +433,17 @@ export class ConversationJobQueue extends JobQueue<ConversationQueueJobData> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (untrustedUuids.length) {
|
if (untrustedUuids.length) {
|
||||||
|
if (type === jobSet.ProfileKey) {
|
||||||
|
log.warn(
|
||||||
|
`Cancelling profile share, since there were ${untrustedUuids.length} untrusted send targets.`
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
log.error(
|
log.error(
|
||||||
`Send failed because ${untrustedUuids.length} conversation(s) were untrusted. Adding to verification list.`
|
`Send failed because ${untrustedUuids.length} conversation(s) were untrusted. Adding to verification list.`
|
||||||
);
|
);
|
||||||
|
|
||||||
window.reduxActions.conversations.conversationStoppedByMissingVerification(
|
window.reduxActions.conversations.conversationStoppedByMissingVerification(
|
||||||
{
|
{
|
||||||
conversationId: conversation.id,
|
conversationId: conversation.id,
|
||||||
|
@@ -32,6 +32,8 @@ import {
|
|||||||
SendMessageProtoError,
|
SendMessageProtoError,
|
||||||
UnregisteredUserError,
|
UnregisteredUserError,
|
||||||
} from '../../textsecure/Errors';
|
} from '../../textsecure/Errors';
|
||||||
|
import { getRecipients } from '../../util/getRecipients';
|
||||||
|
import { getUntrustedConversationUuids } from './getUntrustedConversationUuids';
|
||||||
|
|
||||||
export function canAllErrorsBeIgnored(
|
export function canAllErrorsBeIgnored(
|
||||||
conversation: ConversationAttributesType,
|
conversation: ConversationAttributesType,
|
||||||
@@ -102,27 +104,34 @@ 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.
|
||||||
|
|
||||||
// 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 (isDirectConversation(conversation.attributes)) {
|
||||||
if (!isConversationAccepted(conversation.attributes)) {
|
|
||||||
log.info(
|
|
||||||
`conversation ${conversation.idForLogging()} is not accepted; refusing to send`
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (isConversationUnregistered(conversation.attributes)) {
|
if (isConversationUnregistered(conversation.attributes)) {
|
||||||
log.info(
|
log.info(
|
||||||
`conversation ${conversation.idForLogging()} is unregistered; refusing to send`
|
`conversation ${conversation.idForLogging()} is unregistered; refusing to send`
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (conversation.isBlocked()) {
|
|
||||||
log.info(
|
|
||||||
`conversation ${conversation.idForLogging()} is blocked; refusing to send`
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const proto = await messaging.getContentMessage({
|
const proto = await messaging.getContentMessage({
|
||||||
flags: Proto.DataMessage.Flags.PROFILE_KEY_UPDATE,
|
flags: Proto.DataMessage.Flags.PROFILE_KEY_UPDATE,
|
||||||
@@ -144,6 +153,14 @@ export async function sendProfileKey(
|
|||||||
log.error('No revision provided, but conversation is GroupV2');
|
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();
|
const groupV2Info = conversation.getGroupV2Info();
|
||||||
if (groupV2Info && isNumber(revision)) {
|
if (groupV2Info && isNumber(revision)) {
|
||||||
groupV2Info.revision = revision;
|
groupV2Info.revision = revision;
|
||||||
|
Reference in New Issue
Block a user