sendNormalMessage: Only send just sync message in Note to Self, groups

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
automated-signal 2022-05-05 09:59:56 -07:00 committed by GitHub
parent 53c2305c4d
commit 8614638eb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -7,7 +7,7 @@ import * as Errors from '../../types/errors';
import type { MessageModel } from '../../models/messages';
import { getMessageById } from '../../messages/getMessageById';
import type { ConversationModel } from '../../models/conversations';
import { isGroupV2, isMe } from '../../util/whatTypeOfConversation';
import { isGroup, isGroupV2, isMe } from '../../util/whatTypeOfConversation';
import { getSendOptions } from '../../util/getSendOptions';
import { SignalService as Proto } from '../../protobuf';
import { handleMessageSend } from '../../util/handleMessageSend';
@ -148,6 +148,15 @@ export async function sendNormalMessage(
let messageSendPromise: Promise<CallbackResultType | void>;
if (recipientIdentifiersWithoutMe.length === 0) {
if (!isMe(conversation.attributes) && !isGroup(conversation.attributes)) {
log.info(
'No recipients, but we are not sending to ourselves or to group. Failing job.'
);
markMessageFailed(message, [new Error('No valid recipients')]);
return;
}
// We're sending to Note to Self or a 'lonely group' with just us in it
log.info('sending sync message only');
const dataMessage = await window.textsecure.messaging.getDataMessage({
attachments,