Fix wrong inbox notification counters

Avoid counting grouped notifications separately and omit notifications
for deleted objects.
This commit is contained in:
Rūdolfs Ošiņš
2025-05-08 11:17:36 +02:00
parent 5cb9aaa7fb
commit 01d4c0c5b7
+2 -2
View File
@@ -118,9 +118,9 @@ impl InboxStorage for Sqlite {
notification::ListNotificationsError,
> {
let stmt = self.db.prepare(
"SELECT ref, repo, COUNT(*) as count
"SELECT COUNT(DISTINCT substr(ref, 66)) count, ref, repo
FROM `repository-notifications`
WHERE ref LIKE '%cobs%'
WHERE new NOT NULL AND (ref LIKE '%cobs/xyz.radicle.patch%' OR ref LIKE '%cobs/xyz.radicle.issue%')
GROUP BY repo",
)?;