A couple fixes for the data layer, legacy message upgrade/migrate

This commit is contained in:
Scott Nonnenberg 2018-11-01 11:34:55 -07:00
parent 68e3cade17
commit 9f647f00d8
2 changed files with 1 additions and 53 deletions

View file

@ -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));
}

View file

@ -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 = [];