Skip to content

Commit e95b68f

Browse files
committed
MC-36149: [CLOUD] 'Be the first to review this product' link is not changed after admin has approved the review
1 parent d8498f0 commit e95b68f

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

app/code/Magento/Review/Block/Product/ReviewRenderer.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Magento\Framework\Exception\NoSuchEntityException;
1414
use Magento\Framework\View\Element\Template;
1515
use Magento\Framework\View\Element\Template\Context;
16-
use Magento\Review\Model\AppendSummaryDataToObjectByEntityCodeFactory;
16+
use Magento\Review\Model\AppendSummaryDataFactory;
1717
use Magento\Review\Model\Review;
1818
use Magento\Review\Model\ReviewFactory;
1919
use Magento\Review\Model\ReviewSummaryFactory;
@@ -48,29 +48,29 @@ class ReviewRenderer extends Template implements ReviewRendererInterface
4848
private $reviewSummaryFactory;
4949

5050
/**
51-
* @var AppendSummaryDataToObjectByEntityCodeFactory
51+
* @var AppendSummaryDataFactory
5252
*/
53-
private $appendSummaryDataToObjectByEntityCodeFactory;
53+
private $appendSummaryDataFactory;
5454

5555
/**
5656
* @param Context $context
5757
* @param ReviewFactory $reviewFactory
5858
* @param array $data
5959
* @param ReviewSummaryFactory|null $reviewSummaryFactory
60-
* @param AppendSummaryDataToObjectByEntityCodeFactory|null $appendSummaryDataToObjectByEntityCodeFactory
60+
* @param AppendSummaryDataFactory|null $appendSummaryDataFactory
6161
*/
6262
public function __construct(
6363
Context $context,
6464
ReviewFactory $reviewFactory,
6565
array $data = [],
6666
ReviewSummaryFactory $reviewSummaryFactory = null,
67-
AppendSummaryDataToObjectByEntityCodeFactory $appendSummaryDataToObjectByEntityCodeFactory = null
67+
AppendSummaryDataFactory $appendSummaryDataFactory = null
6868
) {
6969
$this->_reviewFactory = $reviewFactory;
7070
$this->reviewSummaryFactory = $reviewSummaryFactory ??
7171
ObjectManager::getInstance()->get(ReviewSummaryFactory::class);
72-
$this->appendSummaryDataToObjectByEntityCodeFactory = $appendSummaryDataToObjectByEntityCodeFactory ??
73-
ObjectManager::getInstance()->get(AppendSummaryDataToObjectByEntityCodeFactory::class);
72+
$this->appendSummaryDataFactory = $appendSummaryDataFactory ??
73+
ObjectManager::getInstance()->get(AppendSummaryDataFactory::class);
7474
parent::__construct($context, $data);
7575
}
7676

@@ -104,7 +104,7 @@ public function getReviewsSummaryHtml(
104104
$displayIfNoReviews = false
105105
) {
106106
if ($product->getRatingSummary() === null) {
107-
$this->appendSummaryDataToObjectByEntityCodeFactory->create()
107+
$this->appendSummaryDataFactory->create()
108108
->execute(
109109
$product,
110110
$this->_storeManager->getStore()->getId(),

app/code/Magento/Review/Model/AppendSummaryDataToObjectByEntityCode.php renamed to app/code/Magento/Review/Model/AppendSummaryData.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/**
1414
* Add review summary data to object by its entity code
1515
*/
16-
class AppendSummaryDataToObjectByEntityCode
16+
class AppendSummaryData
1717
{
1818
/**
1919
* @var SummaryCollectionFactory
@@ -30,6 +30,8 @@ public function __construct(
3030
}
3131

3232
/**
33+
* Append summary data to object filtered by its entity code
34+
*
3335
* @param AbstractModel $object
3436
* @param int $storeId
3537
* @param string $entityCode
@@ -45,7 +47,7 @@ public function execute(AbstractModel $object, int $storeId, string $entityCode)
4547
'main_table.entity_type = review_entity.entity_id',
4648
'entity_code'
4749
)
48-
->where('entity_pk_value IN (?)', $object->getId())
50+
->where('entity_pk_value = ?', $object->getId())
4951
->where('entity_code = ?', $entityCode);
5052
$summaryItem = $summaryCollection->getFirstItem();
5153

app/code/Magento/Review/Model/ReviewSummary.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* ReviewSummary model.
1515
*
1616
* @deprecated Filtering collection by entity_type ID leads to wrong result if AUTO_INCREMENT begins not form 1.
17-
* @see \Magento\Review\Model\AppendSummaryDataToObjectByEntityCode
17+
* @see \Magento\Review\Model\AppendSummaryData
1818
*/
1919
class ReviewSummary
2020
{
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
use Magento\Catalog\Model\Product;
1111
use Magento\Framework\DB\Select;
12-
use Magento\Review\Model\AppendSummaryDataToObjectByEntityCode;
12+
use Magento\Review\Model\AppendSummaryData;
1313
use Magento\Review\Model\ResourceModel\Review\Summary as ResourceSummary;
1414
use Magento\Review\Model\ResourceModel\Review\Summary\Collection as SummaryCollection;
1515
use Magento\Review\Model\ResourceModel\Review\Summary\CollectionFactory as SummaryCollectionFactory;
@@ -18,9 +18,9 @@
1818
use PHPUnit\Framework\TestCase;
1919

2020
/**
21-
* Unit tests for \Magento\Review\Model\AppendSummaryDataToObjectByEntityCode class
21+
* Unit tests for \Magento\Review\Model\AppendSummaryData class
2222
*/
23-
class AppendSummaryDataToObjectByEntityCodeTest extends TestCase
23+
class AppendSummaryDataTest extends TestCase
2424
{
2525
/**
2626
* @var SummaryCollectionFactory|MockObject
@@ -53,7 +53,7 @@ class AppendSummaryDataToObjectByEntityCodeTest extends TestCase
5353
private $resourceSummaryMock;
5454

5555
/**
56-
* @var AppendSummaryDataToObjectByEntityCode
56+
* @var AppendSummaryData
5757
*/
5858
private $model;
5959

@@ -99,7 +99,7 @@ protected function setUp(): void
9999
->onlyMethods(['getTable'])
100100
->getMock();
101101

102-
$this->model = new AppendSummaryDataToObjectByEntityCode(
102+
$this->model = new AppendSummaryData(
103103
$this->summaryCollectionFactoryMock
104104
);
105105
}

0 commit comments

Comments
 (0)