fix: send approved message only when previously unapproved

pull/3254/head
Audric Ackermann 4 months ago
parent 5f69acde7f
commit fc20bafde3
No known key found for this signature in database

@ -91,7 +91,7 @@ export async function unblockConvoById(conversationId: string) {
export const approveConvoAndSendResponse = async (conversationId: string) => {
const convoToApprove = getConversationController().get(conversationId);
if (!convoToApprove) {
if (!convoToApprove || convoToApprove.isApproved()) {
window?.log?.info('Conversation is already approved.');
return;
}

@ -35,6 +35,7 @@ import { MessageSender } from '../../sending';
import { getIsRinging } from '../RingingManager';
import { getBlackSilenceMediaStream } from './Silence';
import { ed25519Str } from '../String';
import { sleepFor } from '../Promise';
export type InputItem = { deviceId: string; label: string };
@ -534,6 +535,10 @@ export async function USER_callRecipient(recipient: string) {
calledConvo.set('active_at', Date.now()); // addSingleOutgoingMessage does the commit for us on the convo
await calledConvo.unhideIfNeeded(false);
weAreCallerOnCurrentCall = true;
// Not ideal, but also temporary (see you in 2 years).
// We need to make sure the preoffer AND the messageRequestResponse sent in
// approveConvoAndSendResponse have different timestamps, as iOS will throw an error otherwise
await sleepFor(2);
// initiating a call is analogous to sending a message request
await approveConvoAndSendResponse(recipient);

Loading…
Cancel
Save