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

[Framework] New Link is not correctly shown as Current if contains default parts #19134

Merged

Conversation

eduard13
Copy link
Contributor

@eduard13 eduard13 commented Nov 9, 2018

Description (*)

This PR fixes the logic of isCurrent method by comparing the current requested url with the link path. This way we'll always know if the link is current, even it uses some index default parts.

Fixed Issues (if relevant)

  1. New Link is not correctly shown as Current if contains default parts #19099: New Link is not correctly shown as Current if contains default parts

Manual testing scenarios (*)

  1. Add a new link to customer account navigation menu
  2. Navigate to the new added link
  3. The link should have active state in the sidebar
    7bec67d2e5

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-engcom-team magento-engcom-team added Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner Component: Framework/View labels Nov 9, 2018
@magento-engcom-team
Copy link
Contributor

Hi @eduard13. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@eduard13 eduard13 requested a review from rogyar November 9, 2018 14:27
@eduard13 eduard13 changed the title 2.3 develop 19099 issue [Framework] New Link is not correctly shown as Current if contains default parts Nov 9, 2018
@@ -81,7 +85,7 @@ private function getMca()
*/
public function isCurrent()
{
return $this->getCurrent() || $this->getUrl($this->getPath()) == $this->getUrl($this->getMca());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change might be harmful since we stop using getMca() method at all. That means that we can have the current links functionality broken in different places. I would recommend adding an additional check here (by trimming /index/index or so) instead of removing invoking of getMca() method

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rogyar thank you for suggestion, currently the logic of the getMca method was improved, by removing the _defaultPath logic (which was wrong in my opinion). Also there are covered all the cases when a default url part is used.

So having a new link test/index, the following possible cases will mark this link as Current:

  • test
  • test/index
  • test/index/index

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested passing GET parameters via URL as well?

Copy link
Contributor Author

@eduard13 eduard13 Nov 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, with all these cases - the link keeps its current state.

@eduard13
Copy link
Contributor Author

@rogyar is there anything else that I can do here?
Thank you.

@magento-engcom-team
Copy link
Contributor

Hi @eduard13. Thank you for your contribution.
We will aim to release these changes as part of 2.3.1.
Please check the release notes for final confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants