feat: dont expire messages that fail to send

pull/2971/head
William Grant 2 years ago
parent fd73787192
commit c4cc18ad2e

@ -191,7 +191,7 @@ async function send(
await foundMessage.commit();
// window?.log?.info(
// `updated message ${foundMessage.get('id')} with hash: ${foundMessage.get(
// `WIP: updated message ${foundMessage.get('id')} with hash: ${foundMessage.get(
// 'messageHash'
// )}`
// );

@ -187,6 +187,18 @@ async function handleMessageSentFailure(
sent: true,
});
// Disappeared messages that fail to send should not disappear
if (fetchedMessage.get('expirationType') && fetchedMessage.get('expireTimer') > 0) {
fetchedMessage.set({
expirationStartTimestamp: undefined,
});
window.log.debug(
`WIP: [handleMessageSentFailure] Stopping a disappearing message from disppearing until we retry the send operation.\n${JSON.stringify(
fetchedMessage
)}`
);
}
// We don't set the expirationStartTimestamp on a disappearing message here incase the user wishes to try and resend the message
await fetchedMessage.commit();

Loading…
Cancel
Save