PR-5.2-dev PR-5.3-dev Pending

User tests: Successful: Unsuccessful:

avatar janschoenherr
janschoenherr
21 Feb 2025

Currently when getting the item count of a category, the access level is not being taken into account. This PR fixes the issue.

Summary of Changes

Add the access condition to the item subquery.

Testing Instructions

Create a menu item of type List All Categories in an Article Category Tree.

If you navigate to the menu item, it should display a list of categories with an article count.

Bildschirmfoto 2025-02-21 um 14 29 34

Have at least one article in one of the categories restricted by its access level. Make sure you are not logged in.

Actual result BEFORE applying this Pull Request

The access restricted article is being included in the article count.
The Articles > Unauthorized Links option has no effect on the article count.

Expected result AFTER applying this Pull Request

The access restricted article is not being included in the item count.

If however Articles > Unauthorized Links option is set to Yes the access restricted article is included.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar janschoenherr janschoenherr - open - 21 Feb 2025
avatar janschoenherr janschoenherr - change - 21 Feb 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 21 Feb 2025
Category Libraries
avatar janschoenherr janschoenherr - change - 21 Feb 2025
Labels Added: PR-5.2-dev
avatar fgsw
fgsw - comment - 21 Feb 2025

@janschoenherr I think the test instructions belong to the new Articles-module? If so i didn't find where the "Article Count" to set. If not, can you please be more specific in the test instructions?

avatar janschoenherr janschoenherr - change - 21 Feb 2025
The description was changed
avatar janschoenherr janschoenherr - edited - 21 Feb 2025
avatar janschoenherr janschoenherr - change - 21 Feb 2025
The description was changed
avatar janschoenherr janschoenherr - edited - 21 Feb 2025
avatar janschoenherr
janschoenherr - comment - 21 Feb 2025

@janschoenherr I think the test instructions belong to the new Articles-module? If so i didn't find where the "Article Count" to set. If not, can you please be more specific in the test instructions?

I updated the testing instructions.

avatar fgsw fgsw - test_item - 21 Feb 2025 - Tested successfully
avatar fgsw
fgsw - comment - 21 Feb 2025

I have tested this item ✅ successfully on dd5e3b4


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44950.

avatar viocassel viocassel - test_item - 21 Feb 2025 - Tested successfully
avatar viocassel
viocassel - comment - 21 Feb 2025

I have tested this item ✅ successfully on dd5e3b4


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44950.

avatar brianteeman brianteeman - test_item - 21 Feb 2025 - Tested unsuccessfully
avatar brianteeman
brianteeman - comment - 21 Feb 2025

I have tested this item 🔴 unsuccessfully on dd5e3b4


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44950.

avatar brianteeman
brianteeman - comment - 21 Feb 2025

This doesnt take into account what happens when you have unauthorised links set to yes
image

Before the PR the menu item would display the total number of articles and then when entered the category will display the intro text of the registered articles to guest users

After the PR the menu item only displays the public number of articles which if greater than 0 will still display the intro text of the registered articles to guest users. If the number of public articles in the category is 0 then the category will not be displayed at all.

See video

After PR

chrome_RAEUI9rGdb.mp4

Before PR

chrome_04rbtN0569.mp4
avatar brianteeman
brianteeman - comment - 21 Feb 2025

There are probably other areas negatively impacted by this change - this was just the first one that came to mind

avatar joomla-cms-bot joomla-cms-bot - change - 24 Feb 2025
Category Libraries Front End com_content Libraries Modules
avatar janschoenherr
janschoenherr - comment - 24 Feb 2025

I have added a new option accessOnItems to resolve that.

avatar janschoenherr
janschoenherr - comment - 24 Feb 2025

$params = (clone $this->getState('params'))->merge($params);

This actually fixes another bug. Just evaluating the menu params, doesn't take the global component parameters into account. e.g. Use Global (hide) Which might lead to fetching countItems unnecessarily.

avatar fgsw
fgsw - comment - 26 Feb 2025

@janschoenherr Can you update the test instructions including the #44950 (comment) by @brianteeman and your comment?

This actually fixes another bug. Just evaluating the menu params, doesn't take the global component parameters into account. e.g. Use Global (hide) Which might lead to fetching countItems unnecessarily.

avatar janschoenherr janschoenherr - change - 26 Feb 2025
The description was changed
avatar janschoenherr janschoenherr - edited - 26 Feb 2025
avatar janschoenherr
janschoenherr - comment - 26 Feb 2025

This actually fixes another bug. Just evaluating the menu params, doesn't take the global component parameters into account. e.g. Use Global (hide) Which might lead to fetching countItems unnecessarily.

Regarding my additional comment:

You'll have to enable Debug System.

Then set Empty Categories to Show and # Articles in Category to Hide

Bildschirmfoto 2025-02-26 um 13 34 16 in the Global Configuration.

Without the fix, the numItems are still queried:
Bildschirmfoto 2025-02-26 um 13 32 20

With the fix, they are not:
Bildschirmfoto 2025-02-26 um 13 34 01

avatar fgsw fgsw - test_item - 26 Feb 2025 - Tested successfully
avatar fgsw
fgsw - comment - 26 Feb 2025

I have tested this item ✅ successfully on 5085b03

Unauthorised Links No

1-no-unauthorised-test44950 2-no-unauthorised-articlespublicorunauthorised

Unauthorised Links Yes

1-unauthorised-test44950 2-unauthorised-articlespublicorunauthorised
  • The categories All articles are public show 7 articles and No articles show no articles. No difference what value Unauthorised Links is set.
  • Category No articles isn't shown in menu item type List All Categories in an Article Category Tree.
  • Register to read more … works as expected.

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44950.
avatar exlemor exlemor - test_item - 17 Mar 2025 - Tested successfully
avatar exlemor
exlemor - comment - 17 Mar 2025

I have tested this item ✅ successfully on 24db2a0

I have tested this successfully. :)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44950.

avatar fgsw fgsw - test_item - 17 Mar 2025 - Tested successfully
avatar fgsw
fgsw - comment - 17 Mar 2025

I have tested this item ✅ successfully on 24db2a0


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44950.

avatar joomla-cms-bot joomla-cms-bot - change - 17 Mar 2025
Category Libraries Front End com_content Modules Unit Tests Repository Administration com_admin SQL Postgresql com_associations
avatar janschoenherr janschoenherr - change - 17 Mar 2025
Labels Added: Unit/System Tests
avatar joomla-cms-bot joomla-cms-bot - change - 17 Mar 2025
Category Unit Tests Repository Administration com_admin SQL Postgresql com_associations Front End com_content Libraries Modules
avatar exlemor
exlemor - comment - 17 Mar 2025

@janschoenherr - now when I try to test, we have a regression possibly, the results are the same with and without the PR - unlike in my previous test where things were different and matching the aim of the PR (filtering out the item count).... FYI.

avatar janschoenherr janschoenherr - change - 18 Mar 2025
Labels Removed: Unit/System Tests
avatar exlemor
exlemor - comment - 18 Mar 2025

@janschoenherr yes, I am using a menu item of type List All Categories in an Article Category Tree... I just retested it, 1 minute ago and still same reaction - the numbers do not move, if need be, I can make a video...

avatar janschoenherr
janschoenherr - comment - 18 Mar 2025

@exlemor Thanks for testing. Did you set the 'Unauthorised Links' option in Articles to No?

avatar exlemor
exlemor - comment - 18 Mar 2025

@exlemor Thanks for testing. Did you set the 'Unauthorised Links' option in Articles to No?

With Unauthorized Links set to No or Yes, same results with none of the numbers changing ;(
(I cleared cache after each change just in case).

avatar janschoenherr
janschoenherr - comment - 18 Mar 2025

And you are not logged-in in the frontend, right?

avatar exlemor
exlemor - comment - 18 Mar 2025

And you are not logged-in in the frontend, right?

Definitely only logged into the backend. Not the front-end.

avatar exlemor
exlemor - comment - 18 Mar 2025

@janschoenherr - Could the issue be that I set those articles to Special and Super Users vs Registered or Publisher etc?

Just changed one of the articles from Special to Registered and it didn't work either ;( - sorry.

avatar krishnaGandhi11 krishnaGandhi11 - test_item - 18 Mar 2025 - Tested successfully
avatar krishnaGandhi11
krishnaGandhi11 - comment - 18 Mar 2025

I have tested this item ✅ successfully on 0ed6a90


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44950.
avatar krishnaGandhi11
krishnaGandhi11 - comment - 18 Mar 2025

I have tested this item ✅ successfully on 0ed6a90

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44950.

Here's a before-and-after look at the results of this PR!

PR.-.44950.2.1.mp4
avatar joomla-cms-bot joomla-cms-bot - change - 7 Apr 2025
Category Front End com_content Libraries Modules Unit Tests Repository Administration com_admin SQL Postgresql com_associations
avatar janschoenherr janschoenherr - change - 7 Apr 2025
Title
[5.2] Fix item count does not take access level into account
[5.3] Fix item count does not take access level into account
avatar janschoenherr janschoenherr - edited - 7 Apr 2025
avatar joomla-cms-bot joomla-cms-bot - change - 7 Apr 2025
Category Unit Tests Repository Administration com_admin SQL Postgresql com_associations Front End com_content Libraries Modules
avatar janschoenherr
janschoenherr - comment - 7 Apr 2025

@exlemor I rebased the PR to 5.3 now. Thanks for looking into it!

avatar QuyTon
QuyTon - comment - 7 Apr 2025
avatar janschoenherr janschoenherr - change - 7 Apr 2025
Labels Added: PR-5.3-dev
avatar exlemor exlemor - test_item - 7 Apr 2025 - Tested successfully
avatar exlemor
exlemor - comment - 7 Apr 2025

I have tested this item ✅ successfully on cc910c8

I have tested this successfully this time :D.

@janschoenherr (sorry it took me so long to re-test this).


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44950.
avatar janschoenherr
janschoenherr - comment - 8 Apr 2025

Thanks for testing again!

avatar Linkedla Linkedla - test_item - 24 Apr 2025 - Tested successfully
avatar Linkedla
Linkedla - comment - 24 Apr 2025

I have tested this item ✅ successfully on 5aabb98


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44950.

Add a Comment

Login with GitHub to post a comment