Skip to content

Fix For Issue:Incorrect redirect navigate on the review edit page #29318 #30436

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

Open
wants to merge 5 commits into
base: 2.4-develop
Choose a base branch
from

Conversation

Yash-Bhayani
Copy link

@Yash-Bhayani Yash-Bhayani commented Oct 10, 2020

Description (*)

This Pull Request is for the resolution of the issue "Incorrect redirect navigate on the review edit page #29318"
The problem is when user redirects to the customer edit page from the product review edit page by clicking on the customer name at the product review page, the user couldn't redirect back to the product review page when it clicks on back button at customer edit page.I resolved this issue.

Changes in File:

  1. app/code/Magento/Review/Block/Adminhtml/Edit/Form.php:135
    -> in the link of the author(on click of which we redirected to the customer edit page) i added two additional parameter
    (i) fromPath -> so that we can redirect back to the product review page by clicking on back button at customer edit page
    (ii) review_id -> using which id parameter is prepared for back button at customer edit page

  2. app/code/Magento/Customer/Block/Adminhtml/Edit/BackButton.php::getBackUrl

-> i used the passed parameter 'fromPath' and 'review_id' parameter to prepare back url for product review edit page
-> i wants the value of passed parameters so i added dependecy injection of \Magento\Customer\Block\Adminhtml\Edit\Form Block class.

in above file i used URL Encoder and URL Decoder so parameter(router/controller/action) passed as the value of 'fromPath' key interpreted currectly

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes [Issue] Incorrect redirect navigate on the review edit page #29318

Manual testing scenarios (*)

Testing 1:

  1. Go To Marketing -> User Content -> All Reviews
  2. Click on Edit link of any Review
  3. Click on Author Name
  4. Click on "<- Back" Button
  5. User is redirected to the "Edit Review" Page.

Testing 2:

  1. Go To Customers ->Customers -> All Customers
  2. Click on Edit link of Any Customer
  3. Click on "<- Back" Button
  4. User is redirected to the "Customer(Grid)" Page.

Questions or comments

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 are green)

@m2-assistant
Copy link

m2-assistant bot commented Oct 10, 2020

Hi @Yash-Bhayani. 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 give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@Yash-Bhayani
Copy link
Author

#dmcdindia2020

@Yash-Bhayani
Copy link
Author

@magento run all tests

@rogyar
Copy link
Contributor

rogyar commented Oct 10, 2020

@magento give me test instance

@magento-deployment-service
Copy link

Hi @rogyar. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

if ($fromPath=$this->decoder->decode($this->form->getRequest()->getParam('fromPath'))) {
return $this->getUrl(
$fromPath,
['id' => $this->form->getRequest()->getParam('review_id')]
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we need a universal solution for similar cases instead of fixing particular places. We see the same situation when we go to the customer information page from the order view page. So, we may have a couple more places in the admin panel where we have the same issue with the back button.

It would be great if we could find out how to solve this issue for all occurrences.

Hope it makes sense

Copy link
Contributor

@engcom-Foxtrot engcom-Foxtrot Oct 28, 2020

Choose a reason for hiding this comment

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

Hello, @rogyar! I've done some investigation and I don't see the possibility to make a universal and reasonable solution for all "Back" buttons.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @engcom-Foxtrot. I've been reflected on that for some time and you are right. It's not an easy task unless we have the same name for an entity identifier.

Anyway, thank you for checking!

@ghost ghost assigned rogyar Oct 10, 2020
@m2-community-project m2-community-project bot added the Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. label Oct 10, 2020
@sidolov sidolov added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Oct 10, 2020
@engcom-Foxtrot engcom-Foxtrot self-assigned this Oct 27, 2020
@engcom-Foxtrot engcom-Foxtrot removed their assignment Oct 30, 2020
@rogyar
Copy link
Contributor

rogyar commented Jan 4, 2021

Hi @Yash-Bhayani. Could I kindly ask you to cover your changes with an MFTF test, please? According to the definition of done all new changes and fixes should be covered by auto-tests.

Thank you!

@engcom-Foxtrot
Copy link
Contributor

@magento run all tests

@engcom-Foxtrot engcom-Foxtrot added the Auto-Tests: Covered All changes in Pull Request is covered by auto-tests label Jan 18, 2021
@engcom-Foxtrot
Copy link
Contributor

@rogyar covered, please review.

@engcom-Foxtrot
Copy link
Contributor

@magento run all tests

2 similar comments
@engcom-Foxtrot
Copy link
Contributor

@magento run all tests

@engcom-Foxtrot
Copy link
Contributor

@magento run all tests

Copy link
Contributor

@gabrieldagama gabrieldagama left a comment

Choose a reason for hiding this comment

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

Hi @engcom-Foxtrot, can you have a look at my comment below? Thanks!

@@ -32,6 +52,12 @@ public function getButtonData()
*/
public function getBackUrl()
{
if ($fromPath=$this->decoder->decode($this->form->getRequest()->getParam('fromPath'))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of adding this parameter from the request, can't we use the RedirectInterface and the method getRefererUrl? This should return the URL that the request came from.

Copy link
Contributor

@engcom-Foxtrot engcom-Foxtrot Feb 12, 2021

Choose a reason for hiding this comment

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

@gabrieldagama I don't think it's a good idea. This will cause redirect to any previously opened page and works as the 'back' button in the browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Component: Customer Component: Review Event: dmcdindia2020 Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: pending review Release Line: 2.4 Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Issue] Incorrect redirect navigate on the review edit page
6 participants