e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
322 stars 214 forks source link

news: Fix category link in both breadcrumb and menu #4984

Closed Deltik closed 1 year ago

Deltik commented 1 year ago

Motivation and Context

These changes fixed individual symptoms, but not the root cause:

Description

This change reverts both failed fixes and actually addresses the root cause: When rendering the category list, read out the category_id, and e_news_category_item::sc_news_category_url() should be passing in category_id, not id. id cannot mean both the category ID and the news item ID.

How Has This Been Tested?

Manually, I checked both the news_categories menu behavior and the breadcrumb behavior on all news SEF variants at /e107_admin/eurl.php?mode=main&action=config.

Automated tests for the news plugin category SEF URLs are in the new file e107_tests/tests/unit/plugins/news/PluginNewsTest.php.

Types of Changes

Checklist

codeclimate[bot] commented 1 year ago

Code Climate has analyzed commit 1d1f4d08 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 75.0% (80% is the threshold).

This pull request will bring the total coverage in the repository to 34.7% (0.0% change).

View more on Code Climate.

CaMer0n commented 1 year ago

Excellent! Thanks @Deltik