Skip to content

Commit 5885dc7

Browse files
author
Stanislav Idolov
authored
ENGCOM-3068: Fix the issue with customer inline edit when password is expired #18308
2 parents 8e1a5d3 + 6fd1d4e commit 5885dc7

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,14 +6,16 @@
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;
1413
use Magento\Framework\App\Action\HttpPostActionInterface;
14+
use Magento\Framework\Message\MessageInterface;
1515

1616
/**
17+
* Customer inline edit action
18+
*
1719
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1820
*/
1921
class InlineEdit extends \Magento\Backend\App\Action implements HttpPostActionInterface
@@ -102,7 +104,11 @@ private function getEmailNotification()
102104
}
103105

104106
/**
107+
* Inline edit action execute
108+
*
105109
* @return \Magento\Framework\Controller\Result\Json
110+
* @throws \Magento\Framework\Exception\LocalizedException
111+
* @throws \Magento\Framework\Exception\NoSuchEntityException
106112
*/
107113
public function execute()
108114
{
@@ -250,7 +256,7 @@ protected function processAddressData(array $data)
250256
protected function getErrorMessages()
251257
{
252258
$messages = [];
253-
foreach ($this->getMessageManager()->getMessages()->getItems() as $error) {
259+
foreach ($this->getMessageManager()->getMessages()->getErrors() as $error) {
254260
$messages[] = $error->getText();
255261
}
256262
return $messages;
@@ -263,7 +269,7 @@ protected function getErrorMessages()
263269
*/
264270
protected function isErrorExists()
265271
{
266-
return (bool)$this->getMessageManager()->getMessages(true)->getCount();
272+
return (bool)$this->getMessageManager()->getMessages(true)->getCountByType(MessageInterface::TYPE_ERROR);
267273
}
268274

269275
/**

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)