Describe the problem you’re having:
Label counter doesn’t update when count goes down to zero
If possible include steps to reproduce the problem:
- Create a label “testlabel”
- Assign this label to an already read article X
- Switch feed column to “unhide read feeds” mode via “f a” keycommand
- Article count for testlabel is correctly shown as “1”
- Remove “testlabel” from article X
- Article count for testlabel is remains 1, even though there are no articles labelled with this label
To clear article count one have to refresh browser page
tt-rss version (including git commit id):
tt-rss git version 5497a137de85d2412b1381c457127e38ed1f8768
Platform (i.e. Linux distro, PHP, PostgreSQL, etc) versions:
tt-rss@in:/var/www/tt-rss$ cat /etc/debian_version
10.5
tt-rss@in:/var/www/tt-rss$ php --version
PHP 7.3.19-1~deb10u1 (cli) (built: Jul 5 2020 06:46:45) ( NTS )
Copyright © 1997-2018 The PHP Group
Zend Engine v3.3.19, Copyright © 1998-2018 Zend Technologies
with Zend OPcache v7.3.19-1~deb10u1, Copyright © 1999-2018, by Zend Technologies
tt-rss@in:/var/www/tt-rss$ psql --version
psql (PostgreSQL) 11.7 (Debian 11.7-0+deb10u1)
Please provide any additional information below:
The cause seems to be that after removing a label browser issues a “getAllCounters” request to backend, and backend returns counters only for those labels that have any articles in them, “testlabel” is missing from backend response. After making a following change:
diff --git a/classes/counters.php b/classes/counters.php index d8ed27621..4230fa4d4 100644 --- a/classes/counters.php +++ b/classes/counters.php @@ -234,8 +234,8 @@ class Counters { COUNT(u1.unread) AS total FROM ttrss_labels2 LEFT JOIN ttrss_user_labels2 ON (ttrss_labels2.id = label_id) - LEFT JOIN ttrss_user_entries AS u1 ON u1.ref_id = article_id - WHERE ttrss_labels2.owner_uid = :uid AND u1.owner_uid = :uid + LEFT JOIN ttrss_user_entries AS u1 ON u1.ref_id = article_id AND u1.owner_uid = :uid + WHERE ttrss_labels2.owner_uid = :uid GROUP BY ttrss_labels2.id, ttrss_labels2.caption"); $sth->execute([":uid" => $_SESSION['uid']]);
error seems to be fixed in my instance of tt-rss.
I’m not sure, though if that’s correct way to fix this problem – my instance is single-user, and with multiuser tt-rss this change might break counters