diff --git a/app/sql.js b/app/sql.js index 79d51f3b5..623f487f1 100644 --- a/app/sql.js +++ b/app/sql.js @@ -1302,7 +1302,9 @@ async function getMessageBySender({ source, sourceDevice, sent_at }) { async function getAllUnsentMessages() { const rows = await db.all(` - SELECT json FROM messages WHERE NOT sent + SELECT json FROM messages WHERE + type IN ('outgoing', 'friend-request') AND + NOT sent ORDER BY sent_at DESC; `); return map(rows, row => jsonToObject(row.json)); diff --git a/js/background.js b/js/background.js index 1c1afbc9d..07bcbcde6 100644 --- a/js/background.js +++ b/js/background.js @@ -337,6 +337,11 @@ 'expirationStartTimestamp' ); + // Make sure we only target outgoing messages + if (message.isFriendRequest() && message.get('direction') === 'incoming') { + return; + } + if (message.hasErrors()) { return; }