Skip to content

Commit 332e765

Browse files
authored
Merge pull request #5271 from magento-tsg/2.4-develop-pr8
[TSG] Fixes for 2.4 (pr8) (2.4-develop)
2 parents d71050a + fe4a256 commit 332e765

File tree

12 files changed

+102
-117
lines changed

12 files changed

+102
-117
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/Adminhtml/Index/ProductReviews.php

Lines changed: 0 additions & 23 deletions
This file was deleted.

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

Lines changed: 0 additions & 37 deletions
This file was deleted.

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

Lines changed: 0 additions & 11 deletions
This file was deleted.

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

Lines changed: 0 additions & 11 deletions
This file was deleted.

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: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,23 @@
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;
9+
10+
use Magento\Review\Block\Adminhtml\Grid;
711

812
/**
13+
* Review tab in adminhtml area.
14+
*
915
* @api
10-
* @since 100.0.2
1116
*/
12-
class Reviews extends \Magento\Review\Block\Adminhtml\Grid
17+
class Reviews extends Grid
1318
{
1419
/**
15-
* Hide grid mass action elements
20+
* Hide grid mass action elements.
1621
*
17-
* @return \Magento\Customer\Block\Adminhtml\Edit\Tab\Reviews
22+
* @return Reviews
1823
*/
1924
protected function _prepareMassaction()
2025
{
@@ -28,6 +33,6 @@ protected function _prepareMassaction()
2833
*/
2934
public function getGridUrl()
3035
{
31-
return $this->getUrl('customer/*/productReviews', ['_current' => true]);
36+
return $this->getUrl('review/customer/productReviews', ['_current' => true]);
3237
}
3338
}

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
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Review\Controller\Adminhtml\Customer;
9+
10+
use Magento\Backend\App\Action;
11+
use Magento\Backend\App\Action\Context;
12+
use Magento\Customer\Model\CustomerIdProvider;
13+
use Magento\Framework\App\Action\HttpPostActionInterface;
14+
use Magento\Framework\Controller\ResultFactory;
15+
use Magento\Framework\View\Result\Layout;
16+
17+
/**
18+
* Customer product reviews page.
19+
*/
20+
class ProductReviews extends Action implements HttpPostActionInterface
21+
{
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+
42+
/**
43+
* Get customer's product reviews list.
44+
*
45+
* @return Layout
46+
*/
47+
public function execute()
48+
{
49+
$customerId = $this->customerIdProvider->getCustomerId();
50+
/** @var \Magento\Framework\View\Result\Layout $resultLayout */
51+
$resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
52+
$block = $resultLayout->getLayout()->getBlock('admin.customer.reviews');
53+
$block->setCustomerId($customerId)->setUseAjax(true);
54+
55+
return $resultLayout;
56+
}
57+
}

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="reviewGrid"', $body);
449-
}
450-
451440
/**
452441
* @magentoDataFixture Magento/Customer/_files/customer.php
453442
* @magentoDataFixture Magento/Customer/_files/customer_address.php
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Review\Controller\Adminhtml\Customer;
9+
10+
use Magento\Framework\App\Request\Http;
11+
use Magento\TestFramework\TestCase\AbstractBackendController;
12+
13+
/**
14+
* Test for customer product reviews page.
15+
*/
16+
class ProductReviewsTest extends AbstractBackendController
17+
{
18+
/**
19+
* Check Customer product review action.
20+
*
21+
* @magentoDataFixture Magento/Customer/_files/customer_sample.php
22+
* @return void
23+
*/
24+
public function testProductReviewsAction(): void
25+
{
26+
$this->getRequest()->setPostValue(['id' => 1])->setMethod(Http::METHOD_POST);
27+
$this->dispatch('backend/review/customer/productReviews');
28+
$body = $this->getResponse()->getBody();
29+
$this->assertContains('<div id="reviewGrid"', $body);
30+
}
31+
}

0 commit comments

Comments
 (0)