Skip to content

Commit 91a4ba5

Browse files
committed
MC-21347: Remove Customer module's dependency on Review
1 parent c7a2450 commit 91a4ba5

File tree

11 files changed

+82
-41
lines changed

11 files changed

+82
-41
lines changed

app/code/Magento/Customer/Block/Account/Dashboard.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,6 @@ public function getOrdersUrl()
129129
return '';
130130
}
131131

132-
/**
133-
* Retrieve the Url for customer reviews.
134-
*
135-
* @return string
136-
*/
137-
public function getReviewsUrl()
138-
{
139-
return $this->_urlBuilder->getUrl('review/customer/index', ['_secure' => true]);
140-
}
141-
142132
/**
143133
* Retrieve the Url for managing customer wishlist.
144134
*

app/code/Magento/Customer/Controller/Review.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@
66
namespace Magento\Customer\Controller;
77

88
use Magento\Framework\App\Action\Context;
9+
use Magento\Framework\App\Action\HttpGetActionInterface;
910
use Magento\Framework\View\Result\PageFactory;
1011

11-
class Review extends \Magento\Framework\App\Action\Action
12+
/**
13+
* Deprecated class which was in use as general class in Customer Account "My Product Reviews" tab.
14+
*
15+
* @deprecated Remove Customer module's dependency on Review. Non-used class.
16+
* @see \Magento\Review\Controller\Customer
17+
*/
18+
class Review extends \Magento\Framework\App\Action\Action implements HttpGetActionInterface
1219
{
1320
/**
1421
* @var PageFactory
@@ -28,6 +35,8 @@ public function __construct(
2835
}
2936

3037
/**
38+
* Main page in Customer Account "My Product Reviews" tab.
39+
*
3140
* @return \Magento\Framework\View\Result\Page
3241
*/
3342
public function execute()

app/code/Magento/Customer/Controller/Review/Index.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
*/
77
namespace Magento\Customer\Controller\Review;
88

9-
class Index extends \Magento\Customer\Controller\Review
9+
use Magento\Framework\App\Action\HttpGetActionInterface;
10+
11+
/**
12+
* Deprecated class which was in use as main page in Customer Account "My Product Reviews" tab.
13+
*
14+
* @deprecated Remove Customer module's dependency on Review. Non-used class.
15+
* @see \Magento\Review\Controller\Customer\Index
16+
*/
17+
class Index extends \Magento\Customer\Controller\Review implements HttpGetActionInterface
1018
{
1119
}

app/code/Magento/Customer/Controller/Review/View.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
*/
77
namespace Magento\Customer\Controller\Review;
88

9-
class View extends \Magento\Customer\Controller\Review
9+
use Magento\Framework\App\Action\HttpGetActionInterface;
10+
11+
/**
12+
* Deprecated class which was in use as view page in Customer Account "My Product Reviews" tab.
13+
*
14+
* @deprecated Remove Customer module's dependency on Review. Non-used class.
15+
* @see \Magento\Review\Controller\Customer\View
16+
*/
17+
class View extends \Magento\Customer\Controller\Review implements HttpGetActionInterface
1018
{
1119
}

app/code/Magento/Customer/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"magento/module-newsletter": "*",
2020
"magento/module-page-cache": "*",
2121
"magento/module-quote": "*",
22-
"magento/module-review": "*",
2322
"magento/module-sales": "*",
2423
"magento/module-store": "*",
2524
"magento/module-tax": "*",

app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Reviews.php renamed to app/code/Magento/Review/Block/Adminhtml/Edit/Tab/Reviews.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
namespace Magento\Customer\Block\Adminhtml\Edit\Tab;
6+
declare(strict_types=1);
7+
8+
namespace Magento\Review\Block\Adminhtml\Edit\Tab;
79

810
/**
11+
* Review tab in adminhtml area.
12+
*
913
* @api
10-
* @since 100.0.2
1114
*/
1215
class Reviews extends \Magento\Review\Block\Adminhtml\Grid
1316
{
1417
/**
15-
* Hide grid mass action elements
18+
* Hide grid mass action elements.
1619
*
17-
* @return \Magento\Customer\Block\Adminhtml\Edit\Tab\Reviews
20+
* @return \Magento\Review\Block\Adminhtml\Edit\Tab\Reviews
1821
*/
1922
protected function _prepareMassaction()
2023
{
@@ -28,6 +31,6 @@ protected function _prepareMassaction()
2831
*/
2932
public function getGridUrl()
3033
{
31-
return $this->getUrl('customer/*/productReviews', ['_current' => true]);
34+
return $this->getUrl('review/customer/productReviews', ['_current' => true]);
3235
}
3336
}

app/code/Magento/Review/Block/Adminhtml/ReviewTab.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
use Magento\Ui\Component\Layout\Tabs\TabWrapper;
1212

1313
/**
14-
* Class ReviewTab
15-
*
16-
* @package Magento\Review\Block\Adminhtml
14+
* Review tab block.
1715
*/
1816
class ReviewTab extends TabWrapper
1917
{
@@ -30,8 +28,6 @@ class ReviewTab extends TabWrapper
3028
protected $isAjaxLoaded = true;
3129

3230
/**
33-
* Constructor
34-
*
3531
* @param Context $context
3632
* @param Registry $registry
3733
* @param array $data
@@ -67,6 +63,6 @@ public function getTabLabel()
6763
*/
6864
public function getTabUrl()
6965
{
70-
return $this->getUrl('customer/*/productReviews', ['_current' => true]);
66+
return $this->getUrl('review/customer/productReviews', ['_current' => true]);
7167
}
7268
}

app/code/Magento/Customer/Controller/Adminhtml/Index/ProductReviews.php renamed to app/code/Magento/Review/Controller/Adminhtml/Customer/ProductReviews.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,29 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
namespace Magento\Customer\Controller\Adminhtml\Index;
6+
declare(strict_types=1);
77

8-
class ProductReviews extends \Magento\Customer\Controller\Adminhtml\Index
8+
namespace Magento\Review\Controller\Adminhtml\Customer;
9+
10+
use Magento\Framework\App\Action\HttpPostActionInterface;
11+
12+
/**
13+
* Customer product reviews page.
14+
*/
15+
class ProductReviews extends \Magento\Customer\Controller\Adminhtml\Index implements HttpPostActionInterface
916
{
1017
/**
11-
* Get customer's product reviews list
18+
* Get customer's product reviews list.
1219
*
1320
* @return \Magento\Framework\View\Result\Layout
1421
*/
1522
public function execute()
1623
{
17-
$customerId = $this->initCurrentCustomer();
24+
$customerId = (int)$this->initCurrentCustomer();
1825
$resultLayout = $this->resultLayoutFactory->create();
1926
$block = $resultLayout->getLayout()->getBlock('admin.customer.reviews');
2027
$block->setCustomerId($customerId)->setUseAjax(true);
28+
2129
return $resultLayout;
2230
}
2331
}

app/code/Magento/Customer/view/adminhtml/layout/customer_index_productreviews.xml renamed to app/code/Magento/Review/view/adminhtml/layout/review_customer_productreviews.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
-->
88
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
99
<container name="root" label="Root">
10-
<block class="Magento\Customer\Block\Adminhtml\Edit\Tab\Reviews" name="admin.customer.reviews"/>
10+
<block class="Magento\Review\Block\Adminhtml\Edit\Tab\Reviews" name="admin.customer.reviews"/>
1111
</container>
1212
</layout>

dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -437,17 +437,6 @@ public function testCartAction()
437437
$this->assertContains('<div id="customer_cart_grid1"', $body);
438438
}
439439

440-
/**
441-
* @magentoDataFixture Magento/Customer/_files/customer_sample.php
442-
*/
443-
public function testProductReviewsAction()
444-
{
445-
$this->getRequest()->setParam('id', 1);
446-
$this->dispatch('backend/customer/index/productReviews');
447-
$body = $this->getResponse()->getBody();
448-
$this->assertContains('<div id="reviwGrid"', $body);
449-
}
450-
451440
/**
452441
* @magentoDataFixture Magento/Customer/_files/customer.php
453442
* @magentoDataFixture Magento/Customer/_files/customer_address.php

0 commit comments

Comments
 (0)