Skip to content

Commit 57a6fab

Browse files
author
Stanislav Idolov
authored
ENGCOM-3107: [Backport] Fix the issue with customer inline edit when password is expired #18414
2 parents 201f4b9 + 7335851 commit 57a6fab

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

app/code/Magento/Customer/Controller/Adminhtml/Index/InlineEdit.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
namespace Magento\Customer\Controller\Adminhtml\Index;
77

88
use Magento\Backend\App\Action;
9+
use Magento\Customer\Api\CustomerRepositoryInterface;
10+
use Magento\Customer\Api\Data\CustomerInterface;
911
use Magento\Customer\Model\EmailNotificationInterface;
10-
use Magento\Customer\Test\Block\Form\Login;
1112
use Magento\Customer\Ui\Component\Listing\AttributeRepository;
12-
use Magento\Customer\Api\Data\CustomerInterface;
13-
use Magento\Customer\Api\CustomerRepositoryInterface;
13+
use Magento\Framework\Message\MessageInterface;
1414

1515
/**
16+
* Customer inline edit action
17+
*
1618
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1719
*/
1820
class InlineEdit extends \Magento\Backend\App\Action
@@ -101,7 +103,11 @@ private function getEmailNotification()
101103
}
102104

103105
/**
106+
* Inline edit action execute
107+
*
104108
* @return \Magento\Framework\Controller\Result\Json
109+
* @throws \Magento\Framework\Exception\LocalizedException
110+
* @throws \Magento\Framework\Exception\NoSuchEntityException
105111
*/
106112
public function execute()
107113
{
@@ -249,7 +255,7 @@ protected function processAddressData(array $data)
249255
protected function getErrorMessages()
250256
{
251257
$messages = [];
252-
foreach ($this->getMessageManager()->getMessages()->getItems() as $error) {
258+
foreach ($this->getMessageManager()->getMessages()->getErrors() as $error) {
253259
$messages[] = $error->getText();
254260
}
255261
return $messages;
@@ -262,7 +268,7 @@ protected function getErrorMessages()
262268
*/
263269
protected function isErrorExists()
264270
{
265-
return (bool)$this->getMessageManager()->getMessages(true)->getCount();
271+
return (bool)$this->getMessageManager()->getMessages(true)->getCountByType(MessageInterface::TYPE_ERROR);
266272
}
267273

268274
/**

app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/InlineEditTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Customer\Test\Unit\Controller\Adminhtml\Index;
77

88
use Magento\Customer\Model\EmailNotificationInterface;
9+
use Magento\Framework\Message\MessageInterface;
910

1011
/**
1112
* @SuppressWarnings(PHPMD.TooManyFields)
@@ -242,10 +243,11 @@ protected function prepareMocksForErrorMessagesProcessing()
242243
->method('getMessages')
243244
->willReturn($this->messageCollection);
244245
$this->messageCollection->expects($this->once())
245-
->method('getItems')
246+
->method('getErrors')
246247
->willReturn([$this->message]);
247248
$this->messageCollection->expects($this->once())
248-
->method('getCount')
249+
->method('getCountByType')
250+
->with(MessageInterface::TYPE_ERROR)
249251
->willReturn(1);
250252
$this->message->expects($this->once())
251253
->method('getText')

0 commit comments

Comments
 (0)