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

Regression: Multilingual com_tags getting wrong language cookie #17084

Merged
merged 2 commits into from Jul 17, 2017

Conversation

Projects
None yet
7 participants
@infograf768
Member

infograf768 commented Jul 12, 2017

Pull Request for Issue #17053

Summary of Changes

JHelper and JHelperContent do not take into account both ways of setting a lang cookie by the languagefilter plugin.
If the setting is to a year, the cookie is stored separately.
If the setting is set to Session, it is set in the session cookie (this was introduced in #12306 )

com_tags (and possibly some 3rd party extensions) use these classes to display the tags when the parameter is set to use current_language

Testing Instructions

See details in #17053

Set the languagefilter Cookie lifetime to Session:

screen shot 2017-07-12 at 09 45 49

for the following demo, I have created a single tag Mystag.
I have assigned it to the article Another article french tagged to French (fr-FR)
Also to to the article newarticle english tagged to English (en-GB)
And to the article myarticle tagged to ALL content languages.
Create a Tagged Items menu item to display that single tag and make sure Language Filter is set to Current

screen shot 2017-07-12 at 09 53 15

When switching languages, that menu item will now correctly display 2 articles, one set to the Content Language in use, the other set to ALL content languages.
cookies_tags

@mino182
@tonypartridge

@infograf768

This comment has been minimized.

Show comment
Hide comment
@infograf768

infograf768 Jul 12, 2017

Member

Another solution (which would not touch at the helpers) is to use specifically for com_tags, every time we have a current_language conditional (therefore including the tags modules), JFactory: :getApplication()->getLanguage()->getTag(); instead of JHelperContent::getCurrentLanguage()

@mbabker
@rdeutz

What do you think?

Member

infograf768 commented Jul 12, 2017

Another solution (which would not touch at the helpers) is to use specifically for com_tags, every time we have a current_language conditional (therefore including the tags modules), JFactory: :getApplication()->getLanguage()->getTag(); instead of JHelperContent::getCurrentLanguage()

@mbabker
@rdeutz

What do you think?

Show outdated Hide outdated libraries/cms/helper/content.php
if (JLanguageMultilang::isEnabled())
{
$plugin = JPluginHelper::getPlugin('system', 'languagefilter');
$pluginParams = new JRegistry($plugin->params);

This comment has been minimized.

@zero-24

zero-24 Jul 12, 2017

Contributor

New Registry + namespace load here please :)

@zero-24

zero-24 Jul 12, 2017

Contributor

New Registry + namespace load here please :)

This comment has been minimized.

@alikon

alikon Jul 12, 2017

Contributor

this pr is in the 3.7.x branch do we need to namespace in 3.7.x too ???

@alikon

alikon Jul 12, 2017

Contributor

this pr is in the 3.7.x branch do we need to namespace in 3.7.x too ???

This comment has been minimized.

@mbabker

mbabker Jul 12, 2017

Member

Registry has been namespaced since 3.4.

@mbabker

mbabker Jul 12, 2017

Member

Registry has been namespaced since 3.4.

This comment has been minimized.

@infograf768

infograf768 Jul 12, 2017

Member

me not know how to, but if I am asked to use the other solution, this would anyway be obsolete.
@mbabker please let me know your thought

@infograf768

infograf768 Jul 12, 2017

Member

me not know how to, but if I am asked to use the other solution, this would anyway be obsolete.
@mbabker please let me know your thought

This comment has been minimized.

@mbabker

mbabker Jul 12, 2017

Member

For the namespacing thing, look at any other file which has a use Joomla\Registry\Registry; statement, copy that into the same place, and change JRegistry to Registry.

@mbabker

mbabker Jul 12, 2017

Member

For the namespacing thing, look at any other file which has a use Joomla\Registry\Registry; statement, copy that into the same place, and change JRegistry to Registry.

Show outdated Hide outdated libraries/cms/helper/helper.php
if (JLanguageMultilang::isEnabled())
{
$plugin = JPluginHelper::getPlugin('system', 'languagefilter');
$pluginParams = new JRegistry($plugin->params);

This comment has been minimized.

@zero-24

zero-24 Jul 12, 2017

Contributor

Same here

@zero-24

zero-24 Jul 12, 2017

Contributor

Same here

@mbabker

This comment has been minimized.

Show comment
Hide comment
@mbabker

mbabker Jul 12, 2017

Member

I honestly don't know what the purpose of JHelperContent::getCurrentLanguage() is (remember I really don't do multilingual stuff and the sites that I have it on it's all managed by others). The one thing I think seems a little off though is https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/helper/content.php#L159 using the default configured language for the site versus using the active language from JFactory.

Member

mbabker commented Jul 12, 2017

I honestly don't know what the purpose of JHelperContent::getCurrentLanguage() is (remember I really don't do multilingual stuff and the sites that I have it on it's all managed by others). The one thing I think seems a little off though is https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/helper/content.php#L159 using the default configured language for the site versus using the active language from JFactory.

@infograf768

This comment has been minimized.

Show comment
Hide comment
@infograf768

infograf768 Jul 12, 2017

Member

Namespacing done.

Member

infograf768 commented Jul 12, 2017

Namespacing done.

@infograf768

This comment has been minimized.

Show comment
Hide comment
@infograf768

infograf768 Jul 12, 2017

Member

The one thing I think seems a little off though is https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/helper/content.php#L159 using the default configured language for the site versus using the active language from JFactory.

As this is an urgent PR for 3.7.4, I guess it is better, in case we keep modifying the helpers, to leave the rest of the code alone.

Member

infograf768 commented Jul 12, 2017

The one thing I think seems a little off though is https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/helper/content.php#L159 using the default configured language for the site versus using the active language from JFactory.

As this is an urgent PR for 3.7.4, I guess it is better, in case we keep modifying the helpers, to leave the rest of the code alone.

changes done

@joomla-cms-bot joomla-cms-bot removed this from the Joomla 3.7.4 milestone Jul 14, 2017

@AlexRed

This comment has been minimized.

Show comment
Hide comment
@AlexRed

AlexRed Jul 14, 2017

Contributor

I have tested this item successfully on 3a4ad0a

Patch ok for me


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

Contributor

AlexRed commented Jul 14, 2017

I have tested this item successfully on 3a4ad0a

Patch ok for me


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

@infograf768 infograf768 added this to the Joomla 3.7.4 milestone Jul 14, 2017

@zero-24

This comment has been minimized.

Show comment
Hide comment
@zero-24

zero-24 Jul 14, 2017

Contributor

I have tested this item successfully on 3a4ad0a

😄


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

Contributor

zero-24 commented Jul 14, 2017

I have tested this item successfully on 3a4ad0a

😄


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

@zero-24

This comment has been minimized.

Show comment
Hide comment
@zero-24

zero-24 Jul 14, 2017

Contributor

Thanks JM


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

Contributor

zero-24 commented Jul 14, 2017

Thanks JM


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

@joomla-cms-bot joomla-cms-bot removed this from the Joomla 3.7.4 milestone Jul 14, 2017

@joomla-cms-bot joomla-cms-bot added the RTC label Jul 14, 2017

@infograf768 infograf768 added this to the Joomla 3.7.4 milestone Jul 15, 2017

@rdeutz rdeutz merged commit 087ac1f into joomla:staging Jul 17, 2017

5 of 6 checks passed

continuous-integration/jenkins/pr-merge This commit cannot be built
Details
JTracker/HumanTestResults Human Test Results: 2 Successful 0 Failed.
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/drone/pr the build was successful
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
hound No violations found. Woof!

@joomla-cms-bot joomla-cms-bot removed the RTC label Jul 17, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment