Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.2] SEF: Add option to don't set Itemid to homepage by default #42989

Merged
merged 16 commits into from
Aug 29, 2024

Conversation

Hackwar
Copy link
Member

@Hackwar Hackwar commented Mar 9, 2024

This fixes issues #43154, #40991, #43104, #35570, #30818, #42686, #41897.

Summary of Changes

Somewhere before Joomla 2.5.0 a person decided that we need to force an Itemid in each and every case of building a URL, defaulting to the home menu item if none is set. This currently results in the URLs for core components never being allowed to hit the NoMenu rule. The end result is, that these URLs are sometimes not SEFed at all.

This PR is depending on the switch in #43432. (has been merged)

This PR contains a few changed system tests. These tests were either broken, tested broken behavior or with the latest changes were unnecessary.

I'd like to thank Joomla Agentur for sponsoring this change.

Testing Instructions

  1. Install the testing sampledata
  2. create an article in the uncategorised category
  3. search for that article in smart search. Notice that the URL is not SEFed.
  4. switch the "Disallow non-SEF URLs" in the SEF system plugin to yes
  5. Reload the search result page. Notice that the URL now is at least partially SEFed with the URL starting with /component/content/article/[alias]?catid=someID

By using the switch, this is backwards compatible the way it is now. When Joomla 6.0 comes around, the code should be removed completely and the changed behavior would then be the new default.

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

I checked the "no documentation changes needed" for now. I understand that some documentation for this needs to happen, but I don't want to add this to the live documentation yet when the feature has not been accepted yet.

@Hackwar Hackwar added bug RMDQ ReleaseManagerDecisionQueue b/c break This item changes the behavior in an incompatible why. HEADS UP labels Mar 9, 2024
@brianteeman
Copy link
Contributor

You need to carefully look at the previous attempts to change this which result in a clusterf*k requiring a full revert

@laoneo
Copy link
Member

laoneo commented Mar 12, 2024

This should go then into 6.0, or?

@Hackwar
Copy link
Member Author

Hackwar commented Mar 12, 2024

No, this can be made in a b/c way with adding a (temporary) option. This draft is here to allow us all to easily have an installable package and to test the implications. I'm not a fan of adding yet another switch, but I also don't want to throw a change like this onto everyone at once with 6.0. Adding it to 5.2 would give people a years time to give feedback and to test it and we can adjust if something unforeseen comes up.

@Hackwar Hackwar force-pushed the 5.2-router-menuitemid branch from 6012e5d to 46654b1 Compare March 14, 2024 20:02
@Hackwar Hackwar changed the title [5.2] Routing: remove code to set Itemid to homepage by default [5.2] SEF: Add option to don't set Itemid to homepage by default Mar 14, 2024
@Hackwar Hackwar removed RMDQ ReleaseManagerDecisionQueue b/c break This item changes the behavior in an incompatible why. HEADS UP labels Mar 14, 2024
@Hackwar Hackwar marked this pull request as ready for review March 14, 2024 21:11
@brianteeman
Copy link
Contributor

its not unforseen when it has already happened

@Hackwar
Copy link
Member Author

Hackwar commented Mar 14, 2024

Then please enlighten me what already has happened.

@Hackwar
Copy link
Member Author

Hackwar commented Mar 14, 2024

I looked this up and there were a few attempts with #19099, #20979 and #22229, all of which have varying degrees of flaws because other code wasn't taken into consideration. This PR does, so I'm asking people to test this.

@brianteeman
Copy link
Contributor

also see #19415 #19497 #19498 #19499

@pe7er pe7er enabled auto-merge (squash) August 15, 2024 20:10
@brianteeman
Copy link
Contributor

Not sure how this is RTC as the system tests are failing

@Hackwar Hackwar disabled auto-merge August 17, 2024 09:11
@Hackwar
Copy link
Member Author

Hackwar commented Aug 17, 2024

We are aware that there is an issue here. That is the reason why it isn't merged yet. The problem most likely stems from the fact that for new installation this feature is now enabled by default and that again changes behavior which we are testing. I'm still debugging this.

@Hackwar
Copy link
Member Author

Hackwar commented Aug 25, 2024

I had to fix a bug in the component routers for the no-menu-behavior. So back to pending. @robbiejackson, @SniperSister could you test this again?


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

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Aug 25, 2024
@Hackwar
Copy link
Member Author

Hackwar commented Aug 28, 2024

I edited the PR description to contain a paragraph about the changed system tests. I'm still looking for tests for this PR to add it to 5.2. Thank you!

@robbiejackson
Copy link

I have tested this item ✅ successfully on b63b69b

I tested this for com_content using the site module to display list of items in a category using both menu and non-menu rules and it worked OK.

I also patched that module code so that the catid wasn't passed to getArticleRoute() and confirmed that the old code failed but the updated code worked OK.

So this fixes a genuine problem as it could be argued that you shouldn't need the catid to form the article url as all the info is in the article id:alias.


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

@Hackwar
Copy link
Member Author

Hackwar commented Aug 29, 2024

@robbiejackson Are you sure you commented the right PR? It sounds more like you meant to comment on #43992. This PR does improve some issues, but it doesn't add the right catid by looking it up in the DB. Don't get me wrong, I'm happy for every test I can get. 😉

@robbiejackson
Copy link

Yes I'm pretty sure. In this recent version in the com_content router getArticleId you check the id is present in the query params before you use it as the catid in the database query. I just engineered a test case where it wasn't present, there were 2 articles with the same alias, and not using ids in the URLs.

@Hackwar
Copy link
Member Author

Hackwar commented Aug 29, 2024

Thank you!

@coolcat-creations
Copy link
Contributor

I have tested this item ✅ successfully on b63b69b

Tested successfully as described.

Two personal remarks:

  1. Some might disallowed component/content in their robots.txt so maybe this change or behaviour should be mentioned somewhere prominently

  2. It would be nice if the "slug" component/content/article would be adjustable in future


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

@Quy
Copy link
Contributor

Quy commented Aug 29, 2024

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Aug 29, 2024
@pe7er pe7er merged commit b19b923 into joomla:5.2-dev Aug 29, 2024
3 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Aug 29, 2024
@pe7er
Copy link
Contributor

pe7er commented Aug 29, 2024

Thanks @Hackwar !

@Hackwar Hackwar added this to the Joomla! 5.2.0 milestone Aug 29, 2024
@Hackwar Hackwar deleted the 5.2-router-menuitemid branch August 29, 2024 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants