Skip to content

Commit

Permalink
Merge pull request magento#4043 from magento-tsg/2.3-qwerty-pr47
Browse files Browse the repository at this point in the history
[TSG] Upporting for 2.3 (pr47) (2.3-qwerty)
  • Loading branch information
joanhe authored Apr 15, 2019
2 parents e5b64f9 + 3e16b6f commit 3ed7b39
Show file tree
Hide file tree
Showing 23 changed files with 451 additions and 63 deletions.
11 changes: 8 additions & 3 deletions app/code/Magento/Catalog/Controller/Product/Compare/Add.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
use Magento\Framework\Exception\NoSuchEntityException;

/**
* Add item to compare list action.
*/
class Add extends \Magento\Catalog\Controller\Product\Compare implements HttpPostActionInterface
{
/**
* Add item to compare list
* Add item to compare list.
*
* @return \Magento\Framework\Controller\ResultInterface
*/
Expand All @@ -27,12 +30,13 @@ public function execute()
if ($productId && ($this->_customerVisitor->getId() || $this->_customerSession->isLoggedIn())) {
$storeId = $this->_storeManager->getStore()->getId();
try {
/** @var \Magento\Catalog\Model\Product $product */
$product = $this->productRepository->getById($productId, false, $storeId);
} catch (NoSuchEntityException $e) {
$product = null;
}

if ($product) {
if ($product && $product->isSalable()) {
$this->_catalogProductCompareList->addProduct($product);
$productName = $this->_objectManager->get(
\Magento\Framework\Escaper::class
Expand All @@ -41,7 +45,7 @@ public function execute()
'addCompareSuccessMessage',
[
'product_name' => $productName,
'compare_list_url' => $this->_url->getUrl('catalog/product_compare')
'compare_list_url' => $this->_url->getUrl('catalog/product_compare'),
]
);

Expand All @@ -50,6 +54,7 @@ public function execute()

$this->_objectManager->get(\Magento\Catalog\Helper\Product\Compare::class)->calculate();
}

return $resultRedirect->setRefererOrBaseUrl();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
use Magento\Framework\Exception\NoSuchEntityException;

/**
* Remove item from compare list action.
*/
class Remove extends \Magento\Catalog\Controller\Product\Compare implements HttpPostActionInterface
{
/**
* Remove item from compare list
* Remove item from compare list.
*
* @return \Magento\Framework\Controller\ResultInterface
*/
Expand All @@ -22,12 +25,13 @@ public function execute()
if ($productId) {
$storeId = $this->_storeManager->getStore()->getId();
try {
/** @var \Magento\Catalog\Model\Product $product */
$product = $this->productRepository->getById($productId, false, $storeId);
} catch (NoSuchEntityException $e) {
$product = null;
}

if ($product) {
if ($product && $product->isSalable()) {
/** @var $item \Magento\Catalog\Model\Product\Compare\Item */
$item = $this->_compareItemFactory->create();
if ($this->_customerSession->isLoggedIn()) {
Expand Down Expand Up @@ -59,6 +63,7 @@ public function execute()

if (!$this->getRequest()->getParam('isAjax', false)) {
$resultRedirect = $this->resultRedirectFactory->create();

return $resultRedirect->setRefererOrBaseUrl();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@
<argument name="rowIndex" type="string"/>
</arguments>
<reloadPage stepKey="refreshPage"/>
<waitForPageLoad stepKey="waitFormReload"/>
<waitForPageLoad time="30" stepKey="waitFormReload"/>
<click stepKey="clickSelectBtn" selector="{{AdminExportAttributeSection.selectByIndex(rowIndex)}}"/>
<click stepKey="clickOnDelete" selector="{{AdminExportAttributeSection.delete(rowIndex)}}" after="clickSelectBtn"/>
<waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal"/>
<click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmDelete"/>
<waitForPageLoad stepKey="waitForExportDataDeleted" />
<waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitDataGridEmptyMessageAppears"/>
<see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@

<!-- Go to export page -->
<amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/>
<waitForPageLoad stepKey="waitForExportIndexPageLoad"/>

<!-- Fill entity attributes data -->
<actionGroup ref="exportProductsFilterByAttribute" stepKey="exportProductBySku">
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Cms/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
</item>
<item name="media_allowed" xsi:type="array">
<item name="flv" xsi:type="string">video/x-flv</item>
<item name="swf" xsi:type="string">application/x-shockwave-flash</item>
<item name="avi" xsi:type="string">video/x-msvideo</item>
<item name="mov" xsi:type="string">video/x-sgi-movie</item>
<item name="rm" xsi:type="string">application/vnd.rn-realmedia</item>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="SwitchToPreviewIframeActionGroup">
<executeJS function="document.getElementById('preview_iframe').sandbox.add('allow-scripts')" stepKey="addSandboxValue"/>
<wait time="10" stepKey="waitBeforeSwitchToIframe"/>
<switchToIFrame userInput="preview_iframe" stepKey="switchToIframe" />
<waitForPageLoad stepKey="waitForPageLoad"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@
<waitForPageLoad stepKey="waitForPageLoad11"/>
<click selector="{{NewsletterWYSIWYGSection.Preview(_defaultNewsletter.name)}}" stepKey="clickPreview"/>
<switchToWindow stepKey="switchToWindow" userInput="action_window"/>
<switchToIFrame userInput="preview_iframe" stepKey="switchToIframe" />
<waitForPageLoad stepKey="waitForPageLoad9"/>
<actionGroup ref="SwitchToPreviewIframeActionGroup" stepKey="switchToIframe"/>
<!--Verify that the text and image are present-->
<seeElement selector="{{StorefrontNewsletterSection.mediaDescription}}" stepKey="assertMediaDescription"/>
<seeElementInDOM selector="{{StorefrontNewsletterSection.imageSource(ImageUpload3.fileName)}}" stepKey="assertMediaSource"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@
<waitForPageLoad stepKey="waitForPageLoad9" />
<click selector="{{NewsletterWYSIWYGSection.Preview(_defaultNewsletter.name)}}" stepKey="clickPreview1" />
<switchToWindow userInput="action_window" stepKey="switchToWindow1"/>
<switchToIFrame userInput="preview_iframe" stepKey="switchToIframe1" />
<waitForPageLoad stepKey="waitForPageLoad7"/>
<actionGroup ref="SwitchToPreviewIframeActionGroup" stepKey="switchToIframe"/>
<!--see Default Variable on Storefront-->
<see userInput="{{_defaultVariable.city}}" stepKey="seeDefaultVariable" />
<!--see Custom Variable on Storefront-->
Expand All @@ -95,8 +94,7 @@
<amOnPage url="{{NewsletterTemplateGrid.url}}" stepKey="amOnTemplateGrid" />
<click selector="{{NewsletterWYSIWYGSection.Preview(_defaultNewsletter.name)}}" stepKey="clickPreview2" />
<switchToWindow userInput="action_window" stepKey="switchToWindow2"/>
<switchToIFrame userInput="preview_iframe" stepKey="switchToIframe2" />
<wait time="10" stepKey="waitForPageLoad8"/>
<actionGroup ref="SwitchToPreviewIframeActionGroup" stepKey="switchToIframeAfterVariableDelete"/>
<!--see custom variable blank-->
<dontSee userInput="{{customVariable.html}}" stepKey="dontSeeCustomVariableName" />
<closeTab stepKey="closeTab"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<waitForPageLoad stepKey="waitForPageLoad10" />
<click selector="{{NewsletterWYSIWYGSection.Preview(_defaultNewsletter.name)}}" stepKey="clickPreview" />
<switchToWindow stepKey="switchToWindow" userInput="action_window"/>
<switchToIFrame userInput="preview_iframe" stepKey="switchToIframe" />
<actionGroup ref="SwitchToPreviewIframeActionGroup" stepKey="switchToIframe"/>
<waitForText userInput="Home page" stepKey="waitForPageLoad9"/>
<see userInput="Home page" stepKey="seeHomePageCMSPage"/>
<closeTab stepKey="closeTab"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<waitForPageLoad stepKey="waitForPageLoad3" />
<click selector="{{NewsletterWYSIWYGSection.Preview(_defaultNewsletter.name)}}" stepKey="clickPreview" />
<switchToWindow stepKey="switchToWindow" userInput="action_window"/>
<switchToIFrame userInput="preview_iframe" stepKey="switchToIframe" />
<actionGroup ref="SwitchToPreviewIframeActionGroup" stepKey="switchToIframe"/>
<waitForText userInput="Hello World From Newsletter Template!" stepKey="waitForPageLoad2"/>
<see userInput="Hello World From Newsletter Template!" stepKey="seeContent" />
<closeTab stepKey="closeTab"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
frameborder="0"
title="<?= $block->escapeHtmlAttr(__('Preview')) ?>"
width="100%"
sandbox="allow-forms allow-pointer-lock allow-scripts"
sandbox="allow-forms allow-pointer-lock"
>

</iframe>
Expand Down
18 changes: 16 additions & 2 deletions app/code/Magento/Sales/Block/Order/Info/Buttons/Rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/
namespace Magento\Sales\Block\Order\Info\Buttons;

use Magento\Framework\App\ObjectManager;
use Magento\Sales\Model\Rss\Signature;

/**
* Block of links in Order view page
*
Expand All @@ -28,20 +31,29 @@ class Rss extends \Magento\Framework\View\Element\Template
*/
protected $rssUrlBuilder;

/**
* @var Signature
*/
private $signature;

/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Sales\Model\OrderFactory $orderFactory
* @param \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder
* @param array $data
* @param Signature|null $signature
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Sales\Model\OrderFactory $orderFactory,
\Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder,
array $data = []
array $data = [],
Signature $signature = null
) {
$this->orderFactory = $orderFactory;
$this->rssUrlBuilder = $rssUrlBuilder;
$this->signature = $signature ?: ObjectManager::getInstance()->get(Signature::class);

parent::__construct($context, $data);
}

Expand Down Expand Up @@ -103,10 +115,12 @@ protected function getUrlKey($order)
protected function getLinkParams()
{
$order = $this->orderFactory->create()->load($this->_request->getParam('order_id'));
$data = $this->getUrlKey($order);

return [
'type' => 'order_status',
'_secure' => true,
'_query' => ['data' => $this->getUrlKey($order)]
'_query' => ['data' => $data, 'signature' => $this->signature->signData($data)],
];
}
}
Loading

0 comments on commit 3ed7b39

Please sign in to comment.