Fix getUnreadReactionsAndMarkRead
This commit is contained in:
parent
327a38a552
commit
f5312b9463
2 changed files with 20 additions and 6 deletions
|
@ -2152,7 +2152,7 @@ async function getUnreadReactionsAndMarkRead({
|
||||||
const unreadMessages: Array<ReactionResultType> = db
|
const unreadMessages: Array<ReactionResultType> = db
|
||||||
.prepare<Query>(
|
.prepare<Query>(
|
||||||
`
|
`
|
||||||
SELECT rowid, targetAuthorUuid, targetTimestamp, messageId
|
SELECT reactions.rowid, targetAuthorUuid, targetTimestamp, messageId
|
||||||
FROM reactions
|
FROM reactions
|
||||||
JOIN messages on messages.id IS reactions.messageId
|
JOIN messages on messages.id IS reactions.messageId
|
||||||
WHERE
|
WHERE
|
||||||
|
|
|
@ -417,6 +417,17 @@ describe('sql/markRead', () => {
|
||||||
const storyId = getUuid();
|
const storyId = getUuid();
|
||||||
const ourUuid = getUuid();
|
const ourUuid = getUuid();
|
||||||
|
|
||||||
|
const pad: Array<MessageAttributesType> = Array.from({ length: 4 }, _ => {
|
||||||
|
return {
|
||||||
|
id: getUuid(),
|
||||||
|
body: 'pad message',
|
||||||
|
type: 'incoming',
|
||||||
|
conversationId,
|
||||||
|
sent_at: start - 1,
|
||||||
|
received_at: start - 1,
|
||||||
|
timestamp: start - 1,
|
||||||
|
};
|
||||||
|
});
|
||||||
const message1: MessageAttributesType = {
|
const message1: MessageAttributesType = {
|
||||||
id: getUuid(),
|
id: getUuid(),
|
||||||
body: 'message 1',
|
body: 'message 1',
|
||||||
|
@ -464,11 +475,14 @@ describe('sql/markRead', () => {
|
||||||
timestamp: start + 5,
|
timestamp: start + 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
await saveMessages([message1, message2, message3, message4, message5], {
|
await saveMessages(
|
||||||
forceSave: true,
|
[...pad, message1, message2, message3, message4, message5],
|
||||||
ourUuid,
|
{
|
||||||
});
|
forceSave: true,
|
||||||
assert.lengthOf(await _getAllMessages(), 5);
|
ourUuid,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
assert.lengthOf(await _getAllMessages(), pad.length + 5);
|
||||||
|
|
||||||
const reaction1: ReactionType = {
|
const reaction1: ReactionType = {
|
||||||
conversationId,
|
conversationId,
|
||||||
|
|
Loading…
Reference in a new issue