Skip to content

Commit 8ae8b62

Browse files
committed
MC-21347: Remove Customer module's dependency on Review
1 parent bf6bafe commit 8ae8b62

File tree

5 files changed

+39
-11
lines changed

5 files changed

+39
-11
lines changed

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

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

9-
use Magento\Framework\App\Action\HttpGetActionInterface;
9+
use Magento\Customer\Controller\Review;
1010

1111
/**
1212
* Deprecated class which was in use as main page in Customer Account "My Product Reviews" tab.
1313
*
1414
* @deprecated Remove Customer module's dependency on Review. Non-used class.
1515
* @see \Magento\Review\Controller\Customer\Index
1616
*/
17-
class Index extends \Magento\Customer\Controller\Review implements HttpGetActionInterface
17+
class Index extends Review
1818
{
1919
}

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

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

9-
use Magento\Framework\App\Action\HttpGetActionInterface;
9+
use Magento\Customer\Controller\Review;
1010

1111
/**
1212
* Deprecated class which was in use as view page in Customer Account "My Product Reviews" tab.
1313
*
1414
* @deprecated Remove Customer module's dependency on Review. Non-used class.
1515
* @see \Magento\Review\Controller\Customer\View
1616
*/
17-
class View extends \Magento\Customer\Controller\Review implements HttpGetActionInterface
17+
class View extends Review
1818
{
1919
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@
77

88
namespace Magento\Review\Block\Adminhtml\Edit\Tab;
99

10+
use Magento\Review\Block\Adminhtml\Grid;
11+
1012
/**
1113
* Review tab in adminhtml area.
1214
*
1315
* @api
1416
*/
15-
class Reviews extends \Magento\Review\Block\Adminhtml\Grid
17+
class Reviews extends Grid
1618
{
1719
/**
1820
* Hide grid mass action elements.
1921
*
20-
* @return \Magento\Review\Block\Adminhtml\Edit\Tab\Reviews
22+
* @return Reviews
2123
*/
2224
protected function _prepareMassaction()
2325
{

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

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,48 @@
77

88
namespace Magento\Review\Controller\Adminhtml\Customer;
99

10+
use Magento\Backend\App\Action;
11+
use Magento\Backend\App\Action\Context;
12+
use Magento\Customer\Model\CustomerIdProvider;
1013
use Magento\Framework\App\Action\HttpPostActionInterface;
14+
use Magento\Framework\Controller\ResultFactory;
15+
use Magento\Framework\View\Result\Layout;
1116

1217
/**
1318
* Customer product reviews page.
1419
*/
15-
class ProductReviews extends \Magento\Customer\Controller\Adminhtml\Index implements HttpPostActionInterface
20+
class ProductReviews extends Action implements HttpPostActionInterface
1621
{
22+
/**
23+
* Authorization level of a basic admin session
24+
*
25+
* @see _isAllowed()
26+
*/
27+
const ADMIN_RESOURCE = 'Magento_Review::reviews_all';
28+
29+
/** @var CustomerIdProvider */
30+
private $customerIdProvider;
31+
32+
/**
33+
* @param Context $context
34+
* @param CustomerIdProvider $customerIdProvider
35+
*/
36+
public function __construct(Context $context, CustomerIdProvider $customerIdProvider)
37+
{
38+
$this->customerIdProvider = $customerIdProvider;
39+
parent::__construct($context);
40+
}
41+
1742
/**
1843
* Get customer's product reviews list.
1944
*
20-
* @return \Magento\Framework\View\Result\Layout
45+
* @return Layout
2146
*/
2247
public function execute()
2348
{
24-
$customerId = (int)$this->initCurrentCustomer();
25-
$resultLayout = $this->resultLayoutFactory->create();
49+
$customerId = $this->customerIdProvider->getCustomerId();
50+
/** @var \Magento\Framework\View\Result\Layout $resultLayout */
51+
$resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
2652
$block = $resultLayout->getLayout()->getBlock('admin.customer.reviews');
2753
$block->setCustomerId($customerId)->setUseAjax(true);
2854

dev/tests/integration/testsuite/Magento/Review/Controller/Adminhtml/Customer/ProductReviewsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ public function testProductReviewsAction(): void
2626
$this->getRequest()->setPostValue(['id' => 1])->setMethod(Http::METHOD_POST);
2727
$this->dispatch('backend/review/customer/productReviews');
2828
$body = $this->getResponse()->getBody();
29-
$this->assertContains('<div id="reviwGrid"', $body);
29+
$this->assertContains('<div id="reviewGrid"', $body);
3030
}
3131
}

0 commit comments

Comments
 (0)