From 9f647f00d88d72f346e993f276bcdb982955dc8b Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Thu, 1 Nov 2018 11:34:55 -0700 Subject: [PATCH] A couple fixes for the data layer, legacy message upgrade/migrate --- app/sql.js | 52 ---------------------------------------------- js/modules/data.js | 2 +- 2 files changed, 1 insertion(+), 53 deletions(-) diff --git a/app/sql.js b/app/sql.js index fdbb27756d8..66c2d71ed33 100644 --- a/app/sql.js +++ b/app/sql.js @@ -862,10 +862,6 @@ async function getAllPrivateConversations() { ORDER BY id ASC;` ); - if (!rows) { - return null; - } - return map(rows, row => jsonToObject(row.json)); } @@ -880,10 +876,6 @@ async function getAllGroupsInvolvingId(id) { } ); - if (!rows) { - return null; - } - return map(rows, row => jsonToObject(row.json)); } @@ -901,10 +893,6 @@ async function searchConversations(query) { } ); - if (!rows) { - return null; - } - return map(rows, row => jsonToObject(row.json)); } @@ -1121,10 +1109,6 @@ async function getUnreadByConversation(conversationId) { } ); - if (!rows) { - return null; - } - return map(rows, row => jsonToObject(row.json)); } @@ -1145,10 +1129,6 @@ async function getMessagesByConversation( } ); - if (!rows) { - return null; - } - return map(rows, row => jsonToObject(row.json)); } @@ -1162,10 +1142,6 @@ async function getMessagesBySentAt(sentAt) { } ); - if (!rows) { - return null; - } - return map(rows, row => jsonToObject(row.json)); } @@ -1182,10 +1158,6 @@ async function getExpiredMessages() { } ); - if (!rows) { - return null; - } - return map(rows, row => jsonToObject(row.json)); } @@ -1199,10 +1171,6 @@ async function getOutgoingWithoutExpiresAt() { ORDER BY expires_at ASC; `); - if (!rows) { - return null; - } - return map(rows, row => jsonToObject(row.json)); } @@ -1214,10 +1182,6 @@ async function getNextExpiringMessage() { LIMIT 1; `); - if (!rows) { - return null; - } - return map(rows, row => jsonToObject(row.json)); } @@ -1303,10 +1267,6 @@ async function getAllUnprocessed() { 'SELECT json FROM unprocessed ORDER BY timestamp ASC;' ); - if (!rows) { - return null; - } - return map(rows, row => jsonToObject(row.json)); } @@ -1385,10 +1345,6 @@ async function getMessagesNeedingUpgrade(limit, { maxVersion }) { } ); - if (!rows) { - return null; - } - return map(rows, row => jsonToObject(row.json)); } @@ -1408,10 +1364,6 @@ async function getMessagesWithVisualMediaAttachments( } ); - if (!rows) { - return null; - } - return map(rows, row => jsonToObject(row.json)); } @@ -1428,10 +1380,6 @@ async function getMessagesWithFileAttachments(conversationId, { limit }) { } ); - if (!rows) { - return null; - } - return map(rows, row => jsonToObject(row.json)); } diff --git a/js/modules/data.js b/js/modules/data.js index 8fe553efe94..cc2b6ddd6cc 100644 --- a/js/modules/data.js +++ b/js/modules/data.js @@ -834,7 +834,7 @@ async function getLegacyMessagesNeedingUpgrade( ) { const db = await window.Whisper.Database.open(); try { - await new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { const transaction = db.transaction('messages', 'readonly'); const messages = [];