Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.4-develop' into bugfix/issue-3…
Browse files Browse the repository at this point in the history
…0009
  • Loading branch information
Michael Bottens committed Oct 22, 2020
2 parents d4c8d70 + 68c903f commit bd97b9d
Show file tree
Hide file tree
Showing 232 changed files with 5,139 additions and 657 deletions.
4 changes: 2 additions & 2 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Configuration for probot-stale - https://github.com/probot/stale

# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 76
daysUntilStale: 76

# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
Expand All @@ -18,7 +18,7 @@ exemptLabels:
- "Progress: dev in progress"
- "Progress: PR in progress"
- "Progress: done"
- "B2B: GraphQL"
- "B2B: GraphQL"
- "Progress: PR Created"
- "PAP"
- "Project: Login as Customer"
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/AdminNotification/Block/ToolbarEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* Toolbar entry that shows latest notifications
*
* @api
* @author Magento Core Team <[email protected]>
* @since 100.0.2
*/
class ToolbarEntry extends \Magento\Backend\Block\Template
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/AdminNotification/Model/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
/**
* AdminNotification Feed model
*
* @author Magento Core Team <[email protected]>
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @api
* @since 100.0.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/**
* AdminNotification Inbox interface
*
* @author Magento Core Team <[email protected]>
* @api
* @since 100.0.2
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/**
* Notification service model
*
* @author Magento Core Team <[email protected]>
* @api
* @since 100.0.2
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

/**
* AdminNotification Inbox model
*
* @author Magento Core Team <[email protected]>
*/
namespace Magento\AdminNotification\Model\ResourceModel\Grid;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
* AdminNotification Inbox model
*
* @api
* @author Magento Core Team <[email protected]>
* @api
* @since 100.0.2
*/
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

/**
* Collection of unread notifications
*
* @author Magento Core Team <[email protected]>
*/
namespace Magento\AdminNotification\Model\ResourceModel\Inbox\Collection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

/**
* AdminNotification observer
*
* @author Magento Core Team <[email protected]>
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
*/
class PredispatchAdminActionControllerObserver implements ObserverInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* Search queries relations grid container
*
* @api
* @author Magento Core Team <[email protected]>
* @since 100.0.2
*/
class Edit extends \Magento\Backend\Block\Widget\Grid\Container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* Search query relations edit grid
*
* @api
* @author Magento Core Team <[email protected]>
* @since 100.0.2
*/
class Grid extends \Magento\Backend\Block\Widget\Grid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
/**
* Catalog search recommendations resource model
*
* @author Magento Core Team <[email protected]>
* @api
* @since 100.0.2
*/
Expand Down
24 changes: 14 additions & 10 deletions app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public function __construct(
}

/**
* Construct block
*
* @return void
*/
protected function _construct()
Expand All @@ -51,6 +53,14 @@ protected function _construct()

parent::_construct();

$this->buttonList->update('save', 'label', __('Save Attribute'));
$this->buttonList->update('save', 'class', 'save primary');
$this->buttonList->update(
'save',
'data_attribute',
['mage-init' => ['button' => ['event' => 'save', 'target' => '#edit_form']]]
);

if ($this->getRequest()->getParam('popup')) {
$this->buttonList->remove('back');
if ($this->getRequest()->getParam('product_tab') != 'variations') {
Expand All @@ -64,6 +74,8 @@ protected function _construct()
100
);
}
$this->buttonList->update('reset', 'level', 10);
$this->buttonList->update('save', 'class', 'save action-secondary');
} else {
$this->addButton(
'save_and_edit_button',
Expand All @@ -79,14 +91,6 @@ protected function _construct()
);
}

$this->buttonList->update('save', 'label', __('Save Attribute'));
$this->buttonList->update('save', 'class', 'save primary');
$this->buttonList->update(
'save',
'data_attribute',
['mage-init' => ['button' => ['event' => 'save', 'target' => '#edit_form']]]
);

$entityAttribute = $this->_coreRegistry->registry('entity_attribute');
if (!$entityAttribute || !$entityAttribute->getIsUserDefined()) {
$this->buttonList->remove('delete');
Expand All @@ -96,14 +100,14 @@ protected function _construct()
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function addButton($buttonId, $data, $level = 0, $sortOrder = 0, $region = 'toolbar')
{
if ($this->getRequest()->getParam('popup')) {
$region = 'header';
}
parent::addButton($buttonId, $data, $level, $sortOrder, $region);
return parent::addButton($buttonId, $data, $level, $sortOrder, $region);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Block/Product/ListProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ public function getIdentities()
$identities[] = $item->getIdentities();
}
}
$identities = array_merge(...$identities);
$identities = array_merge([], ...$identities);

return $identities;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ public function getItems()
*/
public function getIdentities()
{
$identities = [[]];
$identities = [];
foreach ($this->getItems() as $item) {
$identities[] = $item->getIdentities();
}
return array_merge(...$identities);
return array_merge([], ...$identities);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ public function getItemLimit($type = '')
*/
public function getIdentities()
{
$identities = array_map(function (DataObject $item) {
return $item->getIdentities();
}, $this->getItems()) ?: [[]];

return array_merge(...$identities);
$identities = [];
foreach ($this->getItems() as $item) {
$identities[] = $item->getIdentities();
}
return array_merge([], ...$identities);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\Catalog\Model\Attribute\Backend;

use Magento\Catalog\Model\AbstractModel;
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
use Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend as ParentBackend;
use Magento\Eav\Model\Entity\Attribute\Exception;
use Magento\Framework\DataObject;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Validation\ValidationException;
use Magento\Framework\Validator\HTML\WYSIWYGValidatorInterface;

/**
* Default backend model for catalog attributes.
*/
class DefaultBackend extends ParentBackend
{
/**
* @var WYSIWYGValidatorInterface
*/
private $wysiwygValidator;

/**
* @param WYSIWYGValidatorInterface $wysiwygValidator
*/
public function __construct(WYSIWYGValidatorInterface $wysiwygValidator)
{
$this->wysiwygValidator = $wysiwygValidator;
}

/**
* Validate user HTML value.
*
* @param DataObject $object
* @return void
* @throws LocalizedException
*/
private function validateHtml(DataObject $object): void
{
$attribute = $this->getAttribute();
$code = $attribute->getAttributeCode();
if ($attribute instanceof Attribute && $attribute->getIsHtmlAllowedOnFront()) {
$value = $object->getData($code);
if ($value
&& is_string($value)
&& (!($object instanceof AbstractModel) || $object->getData($code) !== $object->getOrigData($code))
) {
try {
$this->wysiwygValidator->validate($object->getData($code));
} catch (ValidationException $exception) {
$attributeException = new Exception(
__(
'Using restricted HTML elements for "%1". %2',
$attribute->getName(),
$exception->getMessage()
),
$exception
);
$attributeException->setAttributeCode($code)->setPart('backend');
throw $attributeException;
}
}
}
}

/**
* @inheritDoc
*/
public function beforeSave($object)
{
parent::beforeSave($object);
$this->validateHtml($object);

return $this;
}

/**
* @inheritDoc
*/
public function validate($object)
{
$isValid = parent::validate($object);
if ($isValid) {
$this->validateHtml($object);
}

return $isValid;
}
}
Loading

0 comments on commit bd97b9d

Please sign in to comment.