Skip to content

Commit c2ae024

Browse files
author
Cari Spruiell
authored
Merge pull request #3250 from magento-obsessive-owls/owls-delivery
[Owls] PageBuilder Bug Fixes with core updates
2 parents 8e2b6f9 + 07b51b8 commit c2ae024

File tree

5 files changed

+95
-28
lines changed

5 files changed

+95
-28
lines changed

app/code/Magento/CatalogWidget/Block/Product/ProductsList.php

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
/**
1616
* Catalog Products List widget block
17-
* Class ProductsList
17+
*
1818
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1919
*/
2020
class ProductsList extends \Magento\Catalog\Block\Product\AbstractProduct implements BlockInterface, IdentityInterface
@@ -130,7 +130,9 @@ public function __construct(
130130
}
131131

132132
/**
133-
* {@inheritdoc}
133+
* Internal constructor, that is called from real constructor
134+
*
135+
* @return void
134136
*/
135137
protected function _construct()
136138
{
@@ -174,7 +176,14 @@ public function getCacheKeyInfo()
174176
}
175177

176178
/**
177-
* {@inheritdoc}
179+
* Return HTML block with tier price
180+
*
181+
* @param \Magento\Catalog\Model\Product $product
182+
* @param string $priceType
183+
* @param string $renderZone
184+
* @param array $arguments
185+
* @return string
186+
*
178187
* @SuppressWarnings(PHPMD.NPathComplexity)
179188
*/
180189
public function getProductPriceHtml(
@@ -198,20 +207,27 @@ public function getProductPriceHtml(
198207

199208
/** @var \Magento\Framework\Pricing\Render $priceRender */
200209
$priceRender = $this->getLayout()->getBlock('product.price.render.default');
201-
202-
$price = '';
203-
if ($priceRender) {
204-
$price = $priceRender->render(
205-
\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE,
206-
$product,
207-
$arguments
210+
if (!$priceRender) {
211+
$priceRender = $this->getLayout()->createBlock(
212+
\Magento\Framework\Pricing\Render::class,
213+
'product.price.render.default',
214+
['data' => ['price_render_handle' => 'catalog_product_prices']]
208215
);
209216
}
217+
218+
$price = $priceRender->render(
219+
\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE,
220+
$product,
221+
$arguments
222+
);
223+
210224
return $price;
211225
}
212226

213227
/**
214-
* {@inheritdoc}
228+
* Before rendering html, but after trying to load cache
229+
*
230+
* @return $this
215231
*/
216232
protected function _beforeToHtml()
217233
{
@@ -249,6 +265,8 @@ public function createCollection()
249265
}
250266

251267
/**
268+
* Get conditions
269+
*
252270
* @return \Magento\Rule\Model\Condition\Combine
253271
*/
254272
protected function getConditions()
@@ -386,8 +404,9 @@ public function getTitle()
386404
}
387405

388406
/**
389-
* @return PriceCurrencyInterface
407+
* Get currency of product
390408
*
409+
* @return PriceCurrencyInterface
391410
* @deprecated 100.2.0
392411
*/
393412
private function getPriceCurrency()

app/code/Magento/Downloadable/Test/Mftf/Test/AdminRemoveDefaultImageDownloadableProductTest.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
<severity value="MAJOR"/>
1818
<testCaseId value="MC-201"/>
1919
<group value="Downloadable"/>
20-
<skip>
21-
<issueId value="MC-4063"/>
22-
</skip>
2320
</annotations>
2421
<before>
2522
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>

app/code/Magento/Ui/view/base/web/js/lib/view/utils/dom-observer.js

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ define([
1212

1313
var counter = 1,
1414
watchers,
15-
globalObserver;
15+
globalObserver,
16+
disabledNodes = [];
1617

1718
watchers = {
1819
selectors: {},
@@ -238,11 +239,58 @@ define([
238239
};
239240
}
240241

242+
/**
243+
* Verify if the DOM node is a child of a defined disabled node, if so we shouldn't observe provided mutation.
244+
*
245+
* @param {Object} mutation - a single mutation
246+
* @returns {Boolean}
247+
*/
248+
function shouldObserveMutation(mutation) {
249+
var isDisabled;
250+
251+
if (disabledNodes.length > 0) {
252+
// Iterate through the disabled nodes and determine if this mutation is occurring inside one of them
253+
isDisabled = _.find(disabledNodes, function (node) {
254+
return node === mutation.target || $.contains(node, mutation.target);
255+
});
256+
257+
// If we find a matching node we should not observe the mutation
258+
return !isDisabled;
259+
}
260+
261+
return true;
262+
}
263+
264+
/**
265+
* Should we observe these mutations? Check the first and last mutation to determine if this is a disabled mutation,
266+
* we check both the first and last in case one has been removed from the DOM during the process of the mutation.
267+
*
268+
* @param {Array} mutations - An array of mutation records.
269+
* @returns {Boolean}
270+
*/
271+
function shouldObserveMutations(mutations) {
272+
var firstMutation,
273+
lastMutation;
274+
275+
if (mutations.length > 0) {
276+
firstMutation = mutations[0];
277+
lastMutation = mutations[mutations.length - 1];
278+
279+
return shouldObserveMutation(firstMutation) && shouldObserveMutation(lastMutation);
280+
}
281+
282+
return true;
283+
}
284+
241285
globalObserver = new MutationObserver(function (mutations) {
242-
var changes = formChangesLists(mutations);
286+
var changes;
287+
288+
if (shouldObserveMutations(mutations)) {
289+
changes = formChangesLists(mutations);
243290

244-
changes.removed.forEach(processRemoved);
245-
changes.added.forEach(processAdded);
291+
changes.removed.forEach(processRemoved);
292+
changes.added.forEach(processAdded);
293+
}
246294
});
247295

248296
globalObserver.observe(document.body, {
@@ -251,6 +299,16 @@ define([
251299
});
252300

253301
return {
302+
/**
303+
* Disable a node from being observed by the mutations, you may want to disable specific aspects of the
304+
* application which are heavy on DOM changes. The observer running on some actions could cause significant
305+
* delays and degrade the performance of that specific part of the application exponentially.
306+
*
307+
* @param {HTMLElement} node - a HTML node within the document
308+
*/
309+
disableNode: function (node) {
310+
disabledNodes.push(node);
311+
},
254312

255313
/**
256314
* Adds listener for the appearance of nodes that matches provided

app/code/Magento/Ui/view/base/web/js/modal/modal.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -363,14 +363,7 @@ define([
363363
this.modal.data('active', false);
364364

365365
if (this.overlay) {
366-
// In cases when one modal is closed but there is another modal open (e.g. admin notifications)
367-
// to avoid collisions between overlay and modal zIndexes
368-
// overlay zIndex is set to be less than modal one
369-
if (this._getVisibleCount() === 1) {
370-
this.overlay.zIndex(this.prevOverlayIndex - 1);
371-
} else {
372-
this.overlay.zIndex(this.prevOverlayIndex);
373-
}
366+
this.overlay.zIndex(this.prevOverlayIndex - 1);
374367
}
375368
},
376369

dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsPage.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/pages.xsd">
99
<page name="CmsPage" mca="cms/page" module="Magento_Cms">
10-
<block name="cmsPageBlock" class="Magento\Cms\Test\Block\Page" locator=".page-main" strategy="css selector" />
10+
<block name="cmsPageBlock" class="Magento\Cms\Test\Block\Page" locator="#maincontent" strategy="css selector" />
1111
</page>
1212
</config>

0 commit comments

Comments
 (0)