|
|
@ -617,18 +617,17 @@
|
|
|
|
now
|
|
|
|
now
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
const upgradedAttachments =
|
|
|
|
const messageWithSchema = await Message.upgradeSchema({
|
|
|
|
await Promise.all(attachments.map(Attachment.upgradeSchema));
|
|
|
|
type: 'outgoing',
|
|
|
|
const message = this.messageCollection.add({
|
|
|
|
|
|
|
|
body,
|
|
|
|
body,
|
|
|
|
conversationId: this.id,
|
|
|
|
conversationId: this.id,
|
|
|
|
type: 'outgoing',
|
|
|
|
attachments,
|
|
|
|
attachments: upgradedAttachments,
|
|
|
|
|
|
|
|
sent_at: now,
|
|
|
|
sent_at: now,
|
|
|
|
received_at: now,
|
|
|
|
received_at: now,
|
|
|
|
expireTimer: this.get('expireTimer'),
|
|
|
|
expireTimer: this.get('expireTimer'),
|
|
|
|
recipients: this.getRecipients(),
|
|
|
|
recipients: this.getRecipients(),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
const message = this.messageCollection.add(messageWithSchema);
|
|
|
|
if (this.isPrivate()) {
|
|
|
|
if (this.isPrivate()) {
|
|
|
|
message.set({ destination: this.id });
|
|
|
|
message.set({ destination: this.id });
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -641,7 +640,7 @@
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const conversationType = this.get('type');
|
|
|
|
const conversationType = this.get('type');
|
|
|
|
const sendFunc = (() => {
|
|
|
|
const sendFunction = (() => {
|
|
|
|
switch (conversationType) {
|
|
|
|
switch (conversationType) {
|
|
|
|
case Message.PRIVATE:
|
|
|
|
case Message.PRIVATE:
|
|
|
|
return textsecure.messaging.sendMessageToNumber;
|
|
|
|
return textsecure.messaging.sendMessageToNumber;
|
|
|
@ -657,10 +656,10 @@
|
|
|
|
profileKey = storage.get('profileKey');
|
|
|
|
profileKey = storage.get('profileKey');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
message.send(sendFunc(
|
|
|
|
message.send(sendFunction(
|
|
|
|
this.get('id'),
|
|
|
|
this.get('id'),
|
|
|
|
body,
|
|
|
|
body,
|
|
|
|
upgradedAttachments,
|
|
|
|
messageWithSchema.attachments,
|
|
|
|
now,
|
|
|
|
now,
|
|
|
|
this.get('expireTimer'),
|
|
|
|
this.get('expireTimer'),
|
|
|
|
profileKey
|
|
|
|
profileKey
|
|
|
|