address review

pull/1205/head
Audric Ackermann 5 years ago
parent bbebfa4c7e
commit af7f73073b
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -1215,11 +1215,6 @@
const expireTimer = this.get('expireTimer'); const expireTimer = this.get('expireTimer');
const recipients = this.getRecipients(); const recipients = this.getRecipients();
// let profileKey;
// if (this.get('profileSharing')) {
// profileKey = storage.get('profileKey');
// }
this.queueJob(async () => { this.queueJob(async () => {
const now = Date.now(); const now = Date.now();
@ -1329,6 +1324,9 @@
body, body,
timestamp: Date.now(), timestamp: Date.now(),
group: openGroup, group: openGroup,
attachments: uploads.attachments,
preview: uploads.preview,
quote: uploads.quote,
}; };
const openGroupMessage = new libsession.Messages.Outgoing.OpenGroupMessage( const openGroupMessage = new libsession.Messages.Outgoing.OpenGroupMessage(
openGroupParams openGroupParams

@ -1056,11 +1056,16 @@
channel: conversation.get('channelId'), channel: conversation.get('channelId'),
conversationId: conversation.id, conversationId: conversation.id,
}; };
const { body, attachments, preview, quote } = await this.uploadData();
const openGroupParams = { const openGroupParams = {
identifier: this.id, identifier: this.id,
body: this.get('body'), body,
timestamp: Date.now(), timestamp: Date.now(),
group: openGroup, group: openGroup,
attachments,
preview,
quote,
}; };
const openGroupMessage = new libsession.Messages.Outgoing.OpenGroupMessage( const openGroupMessage = new libsession.Messages.Outgoing.OpenGroupMessage(
openGroupParams openGroupParams
@ -1214,7 +1219,7 @@
async handleMessageSentSuccess(sentMessage) { async handleMessageSentSuccess(sentMessage) {
const sentTo = this.get('sent_to') || []; const sentTo = this.get('sent_to') || [];
const isOurDevice = window.libsession.Protocols.MultiDeviceProtocol.isOurDevice( const isOurDevice = await window.libsession.Protocols.MultiDeviceProtocol.isOurDevice(
sentMessage.device sentMessage.device
); );
@ -1224,9 +1229,9 @@
sentMessage.plainTextBuffer sentMessage.plainTextBuffer
); );
const { dataMessage } = contentDecoded; const { dataMessage } = contentDecoded;
this.sendSyncMessageOnly(dataMessage); if (dataMessage) {
this.sendSyncMessage(dataMessage);
this.set({ sentSync: true }); }
} else if (isOurDevice && this.get('sentSync')) { } else if (isOurDevice && this.get('sentSync')) {
this.set({ synced: true }); this.set({ synced: true });
} }
@ -1258,12 +1263,11 @@
await c.getProfiles(); await c.getProfiles();
} }
} }
const isOurDevice = await window.libsession.Protocols.MultiDeviceProtocol.isOurDevice(
sentMessage.device
);
const expirationStartTimestamp = Date.now(); const expirationStartTimestamp = Date.now();
if ( if (isOurDevice && !this.get('sync')) {
sentMessage.device === window.textsecure.storage.user.getNumber() &&
!this.get('sync')
) {
this.set({ sentSync: false }); this.set({ sentSync: false });
} }
this.set({ this.set({
@ -1419,8 +1423,7 @@
}, },
async sendSyncMessage(dataMessage) { async sendSyncMessage(dataMessage) {
// TODO: Return here if we've already sent a sync message if (this.get('synced') || this.get('sentSync')) {
if (this.get('synced')) {
return; return;
} }
@ -1435,6 +1438,11 @@
}); });
await libsession.getMessageQueue().sendSyncMessage(syncMessage); await libsession.getMessageQueue().sendSyncMessage(syncMessage);
this.set({ sentSync: true });
await window.Signal.Data.saveMessage(this.attributes, {
Message: Whisper.Message,
});
}, },
someRecipientsFailed() { someRecipientsFailed() {

Loading…
Cancel
Save