Skip to content

Commit

Permalink
Change Success messages to appropriated
Browse files Browse the repository at this point in the history
  • Loading branch information
nuzil authored and ihor-sviziev committed Jul 22, 2018
1 parent ac4a2fa commit 3533e68
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions app/code/Magento/Newsletter/Controller/Manage/Save.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,24 @@ public function execute()
->getIsSubscribed();
$isSubscribedParam = (boolean)$this->getRequest()
->getParam('is_subscribed', false);
if ($isSubscribedParam != $isSubscribedState) {
if ($isSubscribedParam !== $isSubscribedState) {
$this->customerRepository->save($customer);
if ($isSubscribedParam) {
$subscribeModel = $this->subscriberFactory->create()
->subscribeCustomerById($customerId);
$subscribeStatus = $subscribeModel->getStatus();
if ($subscribeStatus == Subscriber::STATUS_SUBSCRIBED) {
$this->messageManager->addSuccess(__('We saved the subscription.'));
$this->messageManager->addSuccess(__('We have saved your subscription.'));
} else {
$this->messageManager->addSuccess(__('The confirmation request has been sent.'));
$this->messageManager->addSuccess(__('A confirmation request has been sent.'));
}
} else {
$this->subscriberFactory->create()
->unsubscribeCustomerById($customerId);
$this->messageManager->addSuccess(__('We removed the subscription.'));
$this->messageManager->addSuccess(__('We have removed your newsletter subscription.'));
}
} else {
$this->messageManager->addSuccess(__('We updated the subscription.'));
$this->messageManager->addSuccess(__('We have updated your subscription.'));
}
} catch (\Exception $e) {
$this->messageManager->addError(__('Something went wrong while saving your subscription.'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function testSaveAction()
* Check that success message
*/
$this->assertSessionMessages(
$this->equalTo(['We saved the subscription.']),
$this->equalTo(['We have saved your subscription.']),
\Magento\Framework\Message\MessageInterface::TYPE_SUCCESS
);
}
Expand All @@ -85,7 +85,7 @@ public function testSaveActionRemoveSubscription()
* Check that success message
*/
$this->assertSessionMessages(
$this->equalTo(['We updated the subscription.']),
$this->equalTo(['We have updated your subscription.']),
\Magento\Framework\Message\MessageInterface::TYPE_SUCCESS
);
}
Expand Down

0 comments on commit 3533e68

Please sign in to comment.