SafetyNumberChangeDialog: Introduce awareness of stories

This commit is contained in:
Scott Nonnenberg 2022-11-10 20:10:30 -08:00 committed by GitHub
parent 709588a874
commit 5100d17ed2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 2531 additions and 522 deletions

View file

@ -10,6 +10,7 @@ import { blockSendUntilConversationsAreVerified } from './blockSendUntilConversa
import { getMessageIdForLogging } from './idForLogging';
import { isNotNil } from './isNotNil';
import { resetLinkPreview } from '../services/LinkPreview';
import type { RecipientsByConversation } from '../state/ducks/stories';
export async function maybeForwardMessage(
messageAttributes: MessageAttributesType,
@ -40,13 +41,20 @@ export async function maybeForwardMessage(
throw new Error('Cannot send to group');
}
const recipientsByConversation: RecipientsByConversation = {};
conversations.forEach(conversation => {
recipientsByConversation[conversation.id] = {
uuids: conversation.getMemberUuids().map(uuid => uuid.toString()),
};
});
// Verify that all contacts that we're forwarding
// to are verified and trusted.
// If there are any unverified or untrusted contacts, show the
// SendAnywayDialog and if we're fine with sending then mark all as
// verified and trusted and continue the send.
const canSend = await blockSendUntilConversationsAreVerified(
conversations,
recipientsByConversation,
SafetyNumberChangeSource.MessageSend
);
if (!canSend) {