[6.2] Fix: Empty categories displaying due to future-published items#48011
[6.2] Fix: Empty categories displaying due to future-published items#48011hiteshm0 wants to merge 4 commits into
Conversation
|
It's good that you used this in all components that use categories but it's probably not needed in banners as I don't think there is any scenario where that would happen |
|
@brianteeman should i remove the changes made to the banner component? |
|
Consistency is good. I just wondered if the fix could be made earlier so it doesn't have to be repeated but if not then this is fine. |
|
Thanks for you pr, I rebased this to 6.2 since it might not be expected behaviour I think doing this change in a patch release is an unexpected output change and would like to not do such things in a patch version. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
eff7ef1 to
c0217a2
Compare
84756ac to
9de434d
Compare
|
This PR solves #47976 only partially. The category with an article to be published in the future doesn't appear in the list of categories (List All Categories in an Article Category Tree), but in the module "Articles - Categories" is still there. |
|
I have tested this item 🔴 unsuccessfully on 9de434d This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48011. |
and
are both expected behavior if im not wrong ( or rather not caused by a yet to be published article in said category) Should we extend the scope of this PR to fix those bugs too? |
|
For me it is not expected behavior, and if we are correcting it for the list of categories, it should be corrected for the list of categories in the module too. |
|
@drmenzelit |
| <?php endif; ?> | ||
|
|
||
| <?php if ($this->maxLevel != 0 && !empty($this->children[$this->category->id])) : ?> | ||
| <?php |
There was a problem hiding this comment.
In my opinion this code doesn't belong in the view. Normally you find such code in the model or a helper. And it doesn't follow the DRY rule (you need to repeat the code in the other view too).
There was a problem hiding this comment.
you're right, i'll move that logic to a seperate function and call the same function in both places.
Pull Request resolves #47976
Summary of Changes
This PR fixes an issue where categories containing exclusively
future-publisheditems (or items with an expiredpublish_downdate) are incorrectly counted as having active items, causing them to be improperly displayed in frontend category lists and modules[Edit] Scope of the PR was improved to include a fix wherein the heading 'Subcategories' was displayed category blogs/list modules even if there was no valid subcategory to display.
Implementation:
check_datesopt-in parameter to the coreJoomla\CMS\Categories\Categories::_load()method. When enabled, the item-counting subquery strictly enforcespublish_upandpublish_downwindow conditions.$options['check_dates'] = true;in the Category service constructors for com_content, com_contact, com_banners, and com_newsfeeds, as these core components actively utilize scheduled publishing dates.Testing Instructions
Actual result BEFORE applying this Pull Request
The category with the not yet published articles is displayed in the subcategories list


Expected result AFTER applying this Pull Request
The category with the not yet published articles is not displayed in the subcategories list and the heading subcategories is not present either.

Link to documentations
Please select:
Documentation link for guide.joomla.org:
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed