onSentMessage: Create destination conversation before further processing
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
parent
a8ec995173
commit
db623d13b2
5 changed files with 184 additions and 29 deletions
|
@ -138,7 +138,11 @@ import {
|
|||
import { themeChanged } from './shims/themeChanged';
|
||||
import { createIPCEvents } from './util/createIPCEvents';
|
||||
import type { ServiceIdString } from './types/ServiceId';
|
||||
import { ServiceIdKind, isServiceIdString } from './types/ServiceId';
|
||||
import {
|
||||
ServiceIdKind,
|
||||
isPniString,
|
||||
isServiceIdString,
|
||||
} from './types/ServiceId';
|
||||
import { isAciString } from './util/isAciString';
|
||||
import { normalizeAci } from './util/normalizeAci';
|
||||
import * as log from './logging/log';
|
||||
|
@ -2727,6 +2731,25 @@ export async function startApp(): Promise<void> {
|
|||
const sourceServiceId = window.textsecure.storage.user.getAci();
|
||||
strictAssert(source && sourceServiceId, 'Missing user number and uuid');
|
||||
|
||||
// Make sure destination conversation is created before we hit getMessageDescriptor
|
||||
if (data.destinationServiceId !== sourceServiceId) {
|
||||
const { mergePromises } =
|
||||
window.ConversationController.maybeMergeContacts({
|
||||
e164: data.destination,
|
||||
aci: isAciString(data.destinationServiceId)
|
||||
? data.destinationServiceId
|
||||
: undefined,
|
||||
pni: isPniString(data.destinationServiceId)
|
||||
? data.destinationServiceId
|
||||
: undefined,
|
||||
reason: `onSentMessage(${data.timestamp})`,
|
||||
});
|
||||
|
||||
if (mergePromises.length > 0) {
|
||||
await Promise.all(mergePromises);
|
||||
}
|
||||
}
|
||||
|
||||
const messageDescriptor = getMessageDescriptor({
|
||||
...data,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue