mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +00:00
Upgrade message schema before sending
This commit is contained in:
@@ -617,18 +617,17 @@
|
||||
now
|
||||
);
|
||||
|
||||
const upgradedAttachments =
|
||||
await Promise.all(attachments.map(Attachment.upgradeSchema));
|
||||
const message = this.messageCollection.add({
|
||||
const messageWithSchema = await Message.upgradeSchema({
|
||||
type: 'outgoing',
|
||||
body,
|
||||
conversationId: this.id,
|
||||
type: 'outgoing',
|
||||
attachments: upgradedAttachments,
|
||||
attachments,
|
||||
sent_at: now,
|
||||
received_at: now,
|
||||
expireTimer: this.get('expireTimer'),
|
||||
recipients: this.getRecipients(),
|
||||
});
|
||||
const message = this.messageCollection.add(messageWithSchema);
|
||||
if (this.isPrivate()) {
|
||||
message.set({ destination: this.id });
|
||||
}
|
||||
@@ -641,7 +640,7 @@
|
||||
});
|
||||
|
||||
const conversationType = this.get('type');
|
||||
const sendFunc = (() => {
|
||||
const sendFunction = (() => {
|
||||
switch (conversationType) {
|
||||
case Message.PRIVATE:
|
||||
return textsecure.messaging.sendMessageToNumber;
|
||||
@@ -657,10 +656,10 @@
|
||||
profileKey = storage.get('profileKey');
|
||||
}
|
||||
|
||||
message.send(sendFunc(
|
||||
message.send(sendFunction(
|
||||
this.get('id'),
|
||||
body,
|
||||
upgradedAttachments,
|
||||
messageWithSchema.attachments,
|
||||
now,
|
||||
this.get('expireTimer'),
|
||||
profileKey
|
||||
|
||||
Reference in New Issue
Block a user