Always update unreadCount for conversations
This commit is contained in:
parent
794d910d4e
commit
215d90fbe8
3 changed files with 29 additions and 19 deletions
|
@ -3215,7 +3215,8 @@ async function getUnreadCountForConversation(
|
|||
`
|
||||
SELECT COUNT(*) AS unreadCount FROM messages
|
||||
WHERE unread = 1 AND
|
||||
conversationId = $conversationId
|
||||
conversationId = $conversationId AND
|
||||
type = 'incoming';
|
||||
`
|
||||
)
|
||||
.get({
|
||||
|
@ -3346,12 +3347,17 @@ async function getUnreadReactionsAndMarkRead(
|
|||
newestUnreadId,
|
||||
});
|
||||
|
||||
db.exec(`
|
||||
db.prepare(
|
||||
`
|
||||
UPDATE reactions SET
|
||||
unread = 0 WHERE
|
||||
$conversationId = conversationId AND
|
||||
$messageReceivedAt <= messageReceivedAt;
|
||||
`);
|
||||
conversationId = $conversationId AND
|
||||
messageReceivedAt <= $newestUnreadId;
|
||||
`
|
||||
).run({
|
||||
conversationId,
|
||||
newestUnreadId,
|
||||
});
|
||||
|
||||
return unreadMessages;
|
||||
})();
|
||||
|
@ -3385,8 +3391,8 @@ async function markReactionAsRead(
|
|||
`
|
||||
UPDATE reactions SET
|
||||
unread = 0 WHERE
|
||||
$targetAuthorUuid = targetAuthorUuid AND
|
||||
$targetTimestamp = targetTimestamp;
|
||||
targetAuthorUuid = $targetAuthorUuid AND
|
||||
targetTimestamp = $targetTimestamp;
|
||||
`
|
||||
).run({
|
||||
targetAuthorUuid,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue