? Success

User tests: Successful: Unsuccessful:

avatar andrepereiradasilva
andrepereiradasilva
8 Jun 2016

Summary of Changes

This PR makes several changes on the menu alias generate process.

  • Improves alias generation
  • Improves alias conflict detection

Also solves some issues in the current alias generate process:

  1. In a monolingual site (language filter plugin disabled), create a menu item with the same alias as other menu item you have in the same/other menu root but with different language.

    You'll notice it will save with success but it shouldn't.

  2. In a multilingual site (language filter plugin enabled), create a menu item with the same alias as other menu item with All language you have in the same/other menu root but in a different language.

    You'll notice it will save with success but it shouldn't.

  3. Create a menu item of System Links -> Any type

    You'll notice the generate alias is the current date, not menu item title.

Testing Instructions

This needs to be tested with the proper attention.

  • Use latest staging and apply patch
  • Install one adicional language (example: fr-FR)
  • Create the following menu structure:
 Menu Type 1:
 - Menu item A: Language All, Alias: menu-item-a
 - Menu item B: Language en-GB, Alias: menu-item-b
 - Menu item C: Language fr-FR, Alias: menu-item-c
 Menu Type 2:
 - Menu item D: Language All, Alias: menu-item-d
 - Menu item E: Language en-GB, Alias: menu-item-e
 - Menu item F: Language fr-FR, Alias: menu-item-f
  • Apply patch
  • Set the site to monolingual (Disable Language Filter System plugin)
  • Change the alias in Menu item B to menu-item-a. It should give a error message.
  • Change the alias in Menu item F to menu-item-a. It should give a error message.
  • Now set the site to multilingual (Enable Language Filter System plugin)
  • Change the alias in Menu item B to menu-item-a. It should give a error message.
  • Change the alias in Menu item F to menu-item-e. It should save fine.
  • Change the alias in Menu item E to menu-item-a. It should give a error message.
  • Now create a menu item of System Type -> Menu alias and let it auto generate the alias. It should generate fine (without the date as alias).
  • Play a little with the alias and check everything is fine (test with and without unicode in global config).

Finally do a code review of the changes.

Observations

The alias cannot be duplicated in the following cases:

Monolingual Site (language filter plugin disabled)
  1. The menu item is at root level and has the same alias of other menu item that is at root level of any other menu.
  2. The menu item is not at root level, but was the has the same alias of other menu item that has the same parent.
Multilingual Site (language filter plugin enabled)
  1. The menu item language is "All", is at root level and has the same alias of other menu item (any language) that is at root level of any other menu.
  2. The menu item language is NOT "All", is at root level and has the same alias of other menu item (same or "All" language) that is at root level of any other menu.
  3. The menu item language is "All", is not at root level, but was the has the same alias of other menu item (any language) that has the same parent.
  4. The menu item language is "All", is not at root level, but was the has the same alias of other menu item (same or "All" language) that has the same parent.

@infograf768 please check if all is working fine.

avatar andrepereiradasilva andrepereiradasilva - open - 8 Jun 2016
avatar andrepereiradasilva andrepereiradasilva - change - 8 Jun 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 8 Jun 2016
Labels Added: ?
avatar brianteeman brianteeman - change - 8 Jun 2016
Category Components
avatar andrepereiradasilva andrepereiradasilva - change - 8 Jun 2016
The description was changed
7c265f1 8 Jun 2016 avatar andrepereiradasilva cs
d884169 8 Jun 2016 avatar andrepereiradasilva cs
avatar infograf768
infograf768 - comment - 8 Jun 2016

Pleas set the $this->type= 'url' to empty to get a date as the alias is no use for an url and it will avoid an error if the alias is used for another menu item with same parent. THis was the reason it was implemented such originally.

avatar andrepereiradasilva
andrepereiradasilva - comment - 8 Jun 2016

@infograf768 maybe adding a date to a menu item alias of the external link to "save alias" is not the correct behaviour.

Imagine the following scenario.

i have a parent menu item with a external link menu item type. And a child with a article menu item type.

In the before this patch scenario we get a SEF URL something like
/2016-06-08-11-40-42/test-menu-item-article
After this patch we get a /test-menu-item-external-link/test-menu-item-article

avatar infograf768 infograf768 - test_item - 8 Jun 2016 - Tested unsuccessfully
avatar infograf768
infograf768 - comment - 8 Jun 2016

I have tested this item ???? unsuccessfully on d884169


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

avatar infograf768 infograf768 - alter_testresult - 8 Jun 2016 - infograf768: Not tested
avatar infograf768
infograf768 - comment - 8 Jun 2016

Forget the unsuccesful test

avatar infograf768 infograf768 - test_item - 8 Jun 2016 - Tested successfully
avatar infograf768
infograf768 - comment - 8 Jun 2016

I have tested this item successfully on d884169


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

avatar infograf768
infograf768 - comment - 8 Jun 2016

Note: I understand you have prepared the PR to use different strings in the future, but is it really necessary at this point? For the moment, we just want to correct the bug (with ALL).

avatar infograf768
infograf768 - comment - 9 Jun 2016

@brianteeman

You have already tested this. The only difference is that this PR does not change the error message as there was a debate on the link with target blank.
Can you please confirm thsi is working as it solves a long standing possible bug letting save a menu item alias with same alias as another with same parent when language ALL is concerned?

avatar brianteeman brianteeman - test_item - 10 Jun 2016 - Tested successfully
avatar brianteeman
brianteeman - comment - 10 Jun 2016

I have tested this item successfully on d884169


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

avatar brianteeman brianteeman - change - 10 Jun 2016
Status Pending Ready to Commit
avatar brianteeman
brianteeman - comment - 10 Jun 2016

RTC


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

avatar joomla-cms-bot joomla-cms-bot - change - 10 Jun 2016
Labels Added: ?
avatar joomla-cms-bot
joomla-cms-bot - comment - 14 Jun 2016

This PR has received new commits.

CC: @brianteeman, @infograf768


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

avatar izharaazmi
izharaazmi - comment - 14 Jun 2016

Why we are having checks inside store method instead of check itself? Isn't it the whole purpose of check method to be!

Was there any specific reason?

avatar andrepereiradasilva
andrepereiradasilva - comment - 14 Jun 2016

Just removed the dot from the message (shouldn't be a concatenation).
No issues, can still be RTC.

avatar andrepereiradasilva
andrepereiradasilva - comment - 14 Jun 2016

Why we are having checks inside store method instead of check itself? Isn't it the whole purpose of check method to be!
Was there any specific reason?

I had that doubt also, didn't know why was like that, so reused what existed.
See https://github.com/joomla/joomla-cms/blob/staging/libraries/legacy/table/menu.php#L187

avatar izharaazmi
izharaazmi - comment - 14 Jun 2016

IMO, the data should be not strongly coupled with configuration as much as possible. If we can allow same alias for different language selection, that should be true even when multilingual is off (of course by still checking the language attribute). Because we won't be able to revalidate if the settings change.

And I don't think this matter is so straight forward. There must be some association check involved so as to allow alias sharing only for those items which just differ in language and not the content.

E.g. - Following can be a justifiable set to share same alias:

en = How to install Joomla?
es = Cómo instalar Joomla? 

But not for the following set:

en = How to change user permissions?
es = Cómo instalar Joomla?

I don't know what we should do about this, so thought to share here.

PS: es isn't my native language ?

avatar andrepereiradasilva
andrepereiradasilva - comment - 14 Jun 2016

IMO, the data should be not strongly coupled with configuration as much as possible.

I totally agree, but IMHO this is a very special case, is not everyday we change a site from multi-lingual to mono-lingual and vice-versa.

If we can allow same alias for different language selection, that should be true even when multilingual is off (of course by still checking the language attribute).

If we allow the same alias for two menu items in the root level in a mono-lingual site (not matter the language) we'll get the same url in the frontend for two menu items which cannot happen.

@infograf768 please check this.

avatar izharaazmi
izharaazmi - comment - 14 Jun 2016

... we'll get the same url in the frontend for two menu items ...

I undestand. Thats why I said

... I don't think this matter is so straight forward. There must be some association check involved ...

Edit:
But in that case we can choose to display the menu item which either matches '*' language or the site default language, ignoring other specific languages if monolingual is active and multiple items match for the queried alias. Yeah, too much complicated!

avatar infograf768
infograf768 - comment - 14 Jun 2016

If we allow the same alias for two menu items in the root level in a mono-lingual site (not matter the language) we'll get the same url in the frontend for two menu items which cannot happen.
@infograf768 please check this.

indeed. pr is fine by solving this possible issue and i can't believe nobody saw that issue before...

avatar wilsonge wilsonge - close - 15 Jun 2016
avatar wilsonge wilsonge - merge - 15 Jun 2016
avatar joomla-cms-bot joomla-cms-bot - close - 15 Jun 2016
avatar wilsonge wilsonge - change - 15 Jun 2016
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-06-15 23:22:29
Closed_By wilsonge
avatar joomla-cms-bot joomla-cms-bot - change - 15 Jun 2016
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment