Skip to content

Commit

Permalink
🔃 [Magento Community Engineering] Community Contributions - 2.4-devel…
Browse files Browse the repository at this point in the history
…op expedited

Accepted Community Pull Requests:
 - #27026: Issue 27009: Fix error fire on catch when create new theme (by @vincent-le89)
 - #25454: TinyMCE4 hard to input double byte characters on chrome (by @HirokazuNishi)
 - #27083: Cleanup ObjectManager usage - Magento_AsynchronousOperations (by @Bartlomiejsz)
 - #23742: Add Header (h1 - h6) tags to layout xml htmlTags Allowed types (by @furan917)
 - #27149: 27027 added date format adjustment for 'validate-dob' rule (by @sergiy-v)
 - #26642: MAG-251090-26590: Fixed Customer registration multiple form submit (by @princeCB)
 - #27131: 26758 improved cms page custom layout update logic (by @sergiy-v)
 - #26910: security-package/issues/115: Fix AdminSessionsManagerTest and AuthSessionTest.  (by @p-bystritsky)
 - #27196: Remove @author annotation from Magento framework (by @diazwatson)
 - #26563: magento/magento2#: Test Coverage. API functional tests. removeItemFromCart (by @atwixfirster)
 - #26649: table bottom color different then thead and tbody border color (by @tejash-wagento)
 - #27080: Cleanup ObjectManager usage - Magento_EncryptionKey (by @Bartlomiejsz)
 - #27138: Removed unnecessary tabindex property (by @drpayyne)
 - #27082: Cleanup ObjectManager usage - Magento_Analytics (by @Bartlomiejsz)
 - #27084: Cleanup ObjectManager usage - Magento_CacheInvalidate (by @Bartlomiejsz)
 - #22442: Add support for char element to dto factory (by @wardcapp)
 - #27014: Fix #26992 Add new rating is active checkbox alignment issue (by @srsathish92)
 - #26902: Fix #20309 - URL Rewrites redirect loop (by @Bartlomiejsz)
 - #27029: #26847: Added 'enterKey' event handler to prompt widget (by @sergiy-v)
 - #26964: Cleanup ObjectManager usage - Magento_Elasticsearch (by @Bartlomiejsz)
 - #26939: ObjectManager cleanup - Remove usage from AdminNotification module (by @ihor-sviziev)
 - #24878: Create missing directories in imageuploader tree if they don't alread� (by @hostep)
 - #24743: fix issue 24735 (by @dmdanilchenko)
 - #27172: #14086: Guest cart API ignoring cartId in url for some methods (by @engcom-Charlie)


Fixed GitHub Issues:
 - #27009: Missing variable outside CATCH causing a double-fault in Renderer.php  (reported by @HeiderSati) has been fixed in #27026 by @vincent-le89 in 2.4-develop branch
   Related commits:
     1. 1ec6c7f
     2. 01cde22

 - #24637: Chinese input in tinymce 4 (reported by @Consumewithadele) has been fixed in #25454 by @HirokazuNishi in 2.4-develop branch
   Related commits:
     1. aff7824
     2. 1546434

 - #27027: Admin date of birth doesn't factor in user locale set (reported by @extroniks) has been fixed in #27149 by @sergiy-v in 2.4-develop branch
   Related commits:
     1. 8f81132

 - #26590: Customer registration multiple form submit (reported by @Jens-Bourgeois) has been fixed in #26642 by @princeCB in 2.4-develop branch
   Related commits:
     1. d702078
     2. f695643

 - #26758: cms-page-specific layouts are not applied if FullActionName differs from page_view (reported by @Tripuls-Magento) has been fixed in #27131 by @sergiy-v in 2.4-develop branch
   Related commits:
     1. 53c78d5

 - #26648: Table bottom border color different then thead and tbody border color (reported by @tejash-wagento) has been fixed in #26649 by @tejash-wagento in 2.4-develop branch
   Related commits:
     1. 3a5cc24

 - #973: [Question] Add jenkins-ci ant build.xml and tool configurations to repository (reported by @Vinai) has been fixed in #27138 by @drpayyne in 2.4-develop branch
   Related commits:
     1. 945c427

 - #26992: Add New ratings Is active and checkbox alignment issue (reported by @renard123) has been fixed in #27014 by @srsathish92 in 2.4-develop branch
   Related commits:
     1. 0831958
     2. 4ddae72
     3. 97642b5
     4. ee00b98

 - #20309: URL Rewrites redirect loop (reported by @mrmoonlv) has been fixed in #26902 by @Bartlomiejsz in 2.4-develop branch
   Related commits:
     1. 684b951
     2. 0fd6fd3

 - #26847: Hitting enter on create folder in media gallery refreshes the page (reported by @Zyles) has been fixed in #27029 by @sergiy-v in 2.4-develop branch
   Related commits:
     1. 21afe21

 - #22609: Since Magento 2.3 the wysiwyg image uploader incorrectly uses pub/media as storage root. (reported by @hostep) has been fixed in #24878 by @hostep in 2.4-develop branch
   Related commits:
     1. 99a9405

 - #24735: Image in minicart is blurred on iPhone (reported by @ihor-sviziev) has been fixed in #24743 by @dmdanilchenko in 2.4-develop branch
   Related commits:
     1. 6950ead
     2. c7deb42
     3. 8f5f9a5
     4. 3391686
     5. 88d403c

 - #14086: Guest cart API ignoring cartId in url for some methods (reported by @midlan) has been fixed in #27172 by @engcom-Charlie in 2.4-develop branch
   Related commits:
     1. 2bdcc11
     2. 23f9849
     3. e3c2951
  • Loading branch information
magento-engcom-team authored Mar 12, 2020
2 parents dbb7dec + 0e2ae97 commit 047f5b9
Show file tree
Hide file tree
Showing 114 changed files with 1,817 additions and 914 deletions.
59 changes: 31 additions & 28 deletions app/code/Magento/AdminNotification/Block/System/Messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,54 @@
*/
namespace Magento\AdminNotification\Block\System;

class Messages extends \Magento\Backend\Block\Template
use Magento\AdminNotification\Model\ResourceModel\System\Message\Collection\Synchronized;
use Magento\Backend\Block\Template;
use Magento\Backend\Block\Template\Context as TemplateContext;
use Magento\Framework\Json\Helper\Data as JsonDataHelper;
use Magento\Framework\Notification\MessageInterface;
use Magento\Framework\Serialize\Serializer\Json as JsonSerializer;

/**
* AdminNotification Messages class
*/
class Messages extends Template
{
/**
* Message list
* Synchronized Message collection
*
* @var \Magento\AdminNotification\Model\ResourceModel\System\Message\Collection\Synchronized
* @var Synchronized
*/
protected $_messages;

/**
* @var \Magento\Framework\Json\Helper\Data
* @var JsonDataHelper
* @deprecated
*/
protected $jsonHelper;

/**
* @var \Magento\Framework\Serialize\Serializer\Json
* @var JsonSerializer
*/
private $serializer;

/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\AdminNotification\Model\ResourceModel\System\Message\Collection\Synchronized $messages
* @param \Magento\Framework\Json\Helper\Data $jsonHelper
* @param TemplateContext $context
* @param Synchronized $messages
* @param JsonDataHelper $jsonHelper
* @param JsonSerializer $serializer
* @param array $data
* @param \Magento\Framework\Serialize\Serializer\Json|null $serializer
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\AdminNotification\Model\ResourceModel\System\Message\Collection\Synchronized $messages,
\Magento\Framework\Json\Helper\Data $jsonHelper,
array $data = [],
\Magento\Framework\Serialize\Serializer\Json $serializer = null
TemplateContext $context,
Synchronized $messages,
JsonDataHelper $jsonHelper,
JsonSerializer $serializer,
array $data = []
) {
$this->jsonHelper = $jsonHelper;
parent::__construct($context, $data);
$this->_messages = $messages;
$this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Framework\Serialize\Serializer\Json::class);
$this->serializer = $serializer;
}

/**
Expand All @@ -62,16 +71,14 @@ protected function _toHtml()
/**
* Retrieve message list
*
* @return \Magento\Framework\Notification\MessageInterface[]
* @return MessageInterface[]|null
*/
public function getLastCritical()
{
$items = array_values($this->_messages->getItems());
if (isset(
$items[0]
) && $items[0]->getSeverity() == \Magento\Framework\Notification\MessageInterface::SEVERITY_CRITICAL
) {
return $items[0];

if (!empty($items) && current($items)->getSeverity() === MessageInterface::SEVERITY_CRITICAL) {
return current($items);
}
return null;
}
Expand All @@ -83,9 +90,7 @@ public function getLastCritical()
*/
public function getCriticalCount()
{
return $this->_messages->getCountBySeverity(
\Magento\Framework\Notification\MessageInterface::SEVERITY_CRITICAL
);
return $this->_messages->getCountBySeverity(MessageInterface::SEVERITY_CRITICAL);
}

/**
Expand All @@ -95,9 +100,7 @@ public function getCriticalCount()
*/
public function getMajorCount()
{
return $this->_messages->getCountBySeverity(
\Magento\Framework\Notification\MessageInterface::SEVERITY_MAJOR
);
return $this->_messages->getCountBySeverity(MessageInterface::SEVERITY_MAJOR);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\AdminNotification\Controller\Adminhtml\Notification;

use Magento\AdminNotification\Controller\Adminhtml\Notification;
use Magento\AdminNotification\Model\NotificationService;
use Magento\Backend\App\Action;
use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Framework\Controller\ResultFactory;

class AjaxMarkAsRead extends \Magento\AdminNotification\Controller\Adminhtml\Notification
/**
* AdminNotification AjaxMarkAsRead controller
*/
class AjaxMarkAsRead extends Notification implements HttpPostActionInterface
{
/**
* @var \Magento\AdminNotification\Model\NotificationService
* @var NotificationService
*/
private $notificationService;

/**
* @param Action\Context $context
* @param \Magento\AdminNotification\Model\NotificationService|null $notificationService
* @throws \RuntimeException
* @param NotificationService $notificationService
*/
public function __construct(
Action\Context $context,
\Magento\AdminNotification\Model\NotificationService $notificationService = null
) {
public function __construct(Action\Context $context, NotificationService $notificationService)
{
parent::__construct($context);
$this->notificationService = $notificationService?: \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\AdminNotification\Model\NotificationService::class);
$this->notificationService = $notificationService;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\AdminNotification\Controller\Adminhtml\Notification;

class MarkAsRead extends \Magento\AdminNotification\Controller\Adminhtml\Notification
use Magento\AdminNotification\Controller\Adminhtml\Notification;
use Magento\AdminNotification\Model\NotificationService;
use Magento\Backend\App\Action;
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\Exception\LocalizedException;

/**
* AdminNotification MarkAsRead controller
*/
class MarkAsRead extends Notification implements HttpGetActionInterface
{
/**
* Authorization level of a basic admin session
Expand All @@ -16,20 +24,31 @@ class MarkAsRead extends \Magento\AdminNotification\Controller\Adminhtml\Notific
const ADMIN_RESOURCE = 'Magento_AdminNotification::mark_as_read';

/**
* @return void
* @var NotificationService
*/
private $notificationService;

/**
* @param Action\Context $context
* @param NotificationService $notificationService
*/
public function __construct(Action\Context $context, NotificationService $notificationService)
{
parent::__construct($context);
$this->notificationService = $notificationService;
}

/**
* @inheritdoc
*/
public function execute()
{
$notificationId = (int)$this->getRequest()->getParam('id');
if ($notificationId) {
try {
$this->_objectManager->create(
\Magento\AdminNotification\Model\NotificationService::class
)->markAsRead(
$notificationId
);
$this->notificationService->markAsRead($notificationId);
$this->messageManager->addSuccessMessage(__('The message has been marked as Read.'));
} catch (\Magento\Framework\Exception\LocalizedException $e) {
} catch (LocalizedException $e) {
$this->messageManager->addErrorMessage($e->getMessage());
} catch (\Exception $e) {
$this->messageManager->addExceptionMessage(
Expand All @@ -38,9 +57,8 @@ public function execute()
);
}

$this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*')));
return;
return $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*')));
}
$this->_redirect('adminhtml/*/');
return $this->_redirect('adminhtml/*/');
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\AdminNotification\Controller\Adminhtml\Notification;

class MassMarkAsRead extends \Magento\AdminNotification\Controller\Adminhtml\Notification
{
use Magento\AdminNotification\Controller\Adminhtml\Notification;
use Magento\AdminNotification\Model\InboxFactory as InboxModelFactory;
use Magento\Backend\App\Action;
use Magento\Framework\App\Action\HttpPostActionInterface;

/**
* AdminNotification MassMarkAsRead controller
*/
class MassMarkAsRead extends Notification implements HttpPostActionInterface
{
/**
* Authorization level of a basic admin session
*
Expand All @@ -17,7 +23,22 @@ class MassMarkAsRead extends \Magento\AdminNotification\Controller\Adminhtml\Not
const ADMIN_RESOURCE = 'Magento_AdminNotification::mark_as_read';

/**
* @return void
* @var InboxModelFactory
*/
private $inboxModelFactory;

/**
* @param Action\Context $context
* @param InboxModelFactory $inboxModelFactory
*/
public function __construct(Action\Context $context, InboxModelFactory $inboxModelFactory)
{
parent::__construct($context);
$this->inboxModelFactory = $inboxModelFactory;
}

/**
* @inheritdoc
*/
public function execute()
{
Expand All @@ -27,7 +48,7 @@ public function execute()
} else {
try {
foreach ($ids as $id) {
$model = $this->_objectManager->create(\Magento\AdminNotification\Model\Inbox::class)->load($id);
$model = $this->inboxModelFactory->create()->load($id);
if ($model->getId()) {
$model->setIsRead(1)->save();
}
Expand All @@ -44,6 +65,6 @@ public function execute()
);
}
}
$this->_redirect('adminhtml/*/');
return $this->_redirect('adminhtml/*/');
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\AdminNotification\Controller\Adminhtml\Notification;

class MassRemove extends \Magento\AdminNotification\Controller\Adminhtml\Notification
use Magento\AdminNotification\Controller\Adminhtml\Notification;
use Magento\AdminNotification\Model\InboxFactory as InboxModelFactory;
use Magento\Backend\App\Action;
use Magento\Framework\App\Action\HttpPostActionInterface;

/**
* AdminNotification MassRemove controller
*/
class MassRemove extends Notification implements HttpPostActionInterface
{

/**
Expand All @@ -15,9 +22,23 @@ class MassRemove extends \Magento\AdminNotification\Controller\Adminhtml\Notific
* @see _isAllowed()
*/
const ADMIN_RESOURCE = 'Magento_AdminNotification::adminnotification_remove';
/**
* @var InboxModelFactory
*/
private $inboxModelFactory;

/**
* @param Action\Context $context
* @param InboxModelFactory $inboxModelFactory
*/
public function __construct(Action\Context $context, InboxModelFactory $inboxModelFactory)
{
parent::__construct($context);
$this->inboxModelFactory = $inboxModelFactory;
}

/**
* @return void
* @inheritdoc
*/
public function execute()
{
Expand All @@ -27,7 +48,7 @@ public function execute()
} else {
try {
foreach ($ids as $id) {
$model = $this->_objectManager->create(\Magento\AdminNotification\Model\Inbox::class)->load($id);
$model = $this->inboxModelFactory->create()->load($id);
if ($model->getId()) {
$model->setIsRemove(1)->save();
}
Expand All @@ -42,6 +63,6 @@ public function execute()
);
}
}
$this->_redirect('adminhtml/*/');
return $this->_redirect('adminhtml/*/');
}
}
Loading

0 comments on commit 047f5b9

Please sign in to comment.