Remove accidental swapfile, save messages with the id given to them from public server

pull/388/head
Beaudan 6 years ago
parent f718bf15d2
commit f7039080af

@ -1411,6 +1411,7 @@
const { isError } = options;
let messageData = {
id: data.id,
source: data.source,
sourceDevice: data.sourceDevice,
sent_at: data.timestamp,

@ -2014,9 +2014,18 @@
} else {
await conversation.onFriendRequestAccepted();
}
const id = await window.Signal.Data.saveMessage(message.attributes, {
Message: Whisper.Message,
});
let id;
// Force save if the message already has an id, used for public channels
if (message.id) {
id = await window.Signal.Data.saveMessage(message.attributes, {
forceSave: true,
Message: Whisper.Message,
});
} else {
id = await window.Signal.Data.saveMessage(message.attributes, {
Message: Whisper.Message,
});
}
message.set({ id });
MessageController.register(message.id, message);

@ -159,12 +159,14 @@ class LokiPublicChannelAPI {
let timestamp = new Date(adnMessage.created_at).getTime();
let from = adnMessage.user.username;
let source;
let id;
if (adnMessage.annotations.length) {
const noteValue = adnMessage.annotations[0].value;
({ from, timestamp, source } = noteValue);
({ from, timestamp, source, id } = noteValue);
}
const messageData = {
id,
friendRequest: false,
source,
sourceDevice: 1,

Binary file not shown.
Loading…
Cancel
Save