unsend for me only on a closed group only deletes locally

also do not await request to PN server
pull/1985/head
Audric Ackermann 4 years ago
parent 5d9565a559
commit bb26680b75
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -187,7 +187,7 @@ async function unsendMessageJustForThisUser(
const unsendMsgObjects = getUnsendMessagesObjects(msgsToDelete);
// sending to recipient all the messages separately for now
// sending to our other devices all the messages separately for now
await Promise.all(
unsendMsgObjects.map(unsendObject =>
getMessageQueue()
@ -279,6 +279,17 @@ const doDeleteSelectedMessages = async ({
}
return unsendMessagesForEveryone(conversation, selectedMessages);
}
// delete just for me in a closed group only means delete locally
if (conversation.isClosedGroup()) {
await deleteMessagesFromSwarmAndCompletelyLocally(conversation, selectedMessages);
// Update view and trigger update
window.inboxStore?.dispatch(resetSelectedMessageIds());
ToastUtils.pushDeleted();
return;
}
// otherwise, delete that message locally, from our swarm and from our other devices
return unsendMessageJustForThisUser(conversation, selectedMessages);
//#endregion

@ -16,7 +16,10 @@ export async function notifyPnServer(wrappedEnvelope: ArrayBuffer, sentTo: strin
},
};
const endpoint = 'notify';
return serverRequest(`${pnServerUrl}/${endpoint}`, options);
const ret = await serverRequest(`${pnServerUrl}/${endpoint}`, options);
if (!ret) {
window?.log?.warn('Push notification server request returned false');
}
}
type ServerRequestOptionsType = {

@ -501,8 +501,16 @@ async function handleTypingMessage(
async function handleUnsendMessage(envelope: EnvelopePlus, unsendMessage: SignalService.Unsend) {
const { author: messageAuthor, timestamp } = unsendMessage;
//#region early exit conditions
if (messageAuthor !== (envelope.senderIdentity || envelope.source)) {
window?.log?.error(
'handleUnsendMessage: Dropping request as the author and the sender differs.'
);
await removeFromCache(envelope);
return;
}
if (!unsendMessage) {
//#region early exit conditions
window?.log?.error('handleUnsendMessage: Invalid parameters -- dropping message.');
}
if (!timestamp) {

@ -95,11 +95,8 @@ export class MessageSentHandler {
if (!wrappedEnvelope) {
window?.log?.warn('Should send PN notify but no wrapped envelope set.');
} else {
// we do not really care about the retsult.
const pnNotifyRet = await PnServer.notifyPnServer(wrappedEnvelope, sentMessage.device);
if (!pnNotifyRet) {
window?.log?.warn('Push notification server request returned false');
}
// we do not really care about the result, neither of waiting for it
void PnServer.notifyPnServer(wrappedEnvelope, sentMessage.device);
}
}

Loading…
Cancel
Save