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
|
||||
.prepare<Query>(
|
||||
`
|
||||
SELECT rowid, targetAuthorUuid, targetTimestamp, messageId
|
||||
SELECT reactions.rowid, targetAuthorUuid, targetTimestamp, messageId
|
||||
FROM reactions
|
||||
JOIN messages on messages.id IS reactions.messageId
|
||||
WHERE
|
||||
|
|
|
@ -417,6 +417,17 @@ describe('sql/markRead', () => {
|
|||
const storyId = 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 = {
|
||||
id: getUuid(),
|
||||
body: 'message 1',
|
||||
|
@ -464,11 +475,14 @@ describe('sql/markRead', () => {
|
|||
timestamp: start + 5,
|
||||
};
|
||||
|
||||
await saveMessages([message1, message2, message3, message4, message5], {
|
||||
forceSave: true,
|
||||
ourUuid,
|
||||
});
|
||||
assert.lengthOf(await _getAllMessages(), 5);
|
||||
await saveMessages(
|
||||
[...pad, message1, message2, message3, message4, message5],
|
||||
{
|
||||
forceSave: true,
|
||||
ourUuid,
|
||||
}
|
||||
);
|
||||
assert.lengthOf(await _getAllMessages(), pad.length + 5);
|
||||
|
||||
const reaction1: ReactionType = {
|
||||
conversationId,
|
||||
|
|
Loading…
Reference in a new issue