mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-05-08 08:58:38 +01:00
Data layer: return null if id not in database, not empty model
This commit is contained in:
@@ -254,6 +254,10 @@ async function _removeMessages(ids) {
|
|||||||
|
|
||||||
async function getMessageById(id, { Message }) {
|
async function getMessageById(id, { Message }) {
|
||||||
const message = await channels.getMessageById(id);
|
const message = await channels.getMessageById(id);
|
||||||
|
if (!message) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return new Message(message);
|
return new Message(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,6 +356,10 @@ async function getAllUnprocessed() {
|
|||||||
|
|
||||||
async function getUnprocessedById(id, { Unprocessed }) {
|
async function getUnprocessedById(id, { Unprocessed }) {
|
||||||
const unprocessed = await channels.getUnprocessedById(id);
|
const unprocessed = await channels.getUnprocessedById(id);
|
||||||
|
if (!unprocessed) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return new Unprocessed(unprocessed);
|
return new Unprocessed(unprocessed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user