Skip to content

Commit

Permalink
Merge pull request #9063 from magento-gl/Hammer_248beta1_Scope03072024
Browse files Browse the repository at this point in the history
[Hammer] 2.4.8-beta1 Scope
  • Loading branch information
2 parents fe2e144 + 9615cef commit de4dfb8
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 37 deletions.
20 changes: 18 additions & 2 deletions app/code/Magento/Customer/Block/Widget/Dob.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class Dob extends AbstractWidget
/**
* Constants for borders of date-type customer attributes
*/
const MIN_DATE_RANGE_KEY = 'date_range_min';
public const MIN_DATE_RANGE_KEY = 'date_range_min';

const MAX_DATE_RANGE_KEY = 'date_range_max';
public const MAX_DATE_RANGE_KEY = 'date_range_max';

/**
* @var array
Expand Down Expand Up @@ -303,6 +303,7 @@ public function getHtmlExtraParams()
public function getDateFormat()
{
$dateFormat = $this->setTwoDayPlaces($this->_localeDate->getDateFormatWithLongYear());
$dateFormat = $this->setTwoMonthPlaces($dateFormat);
/** Escape RTL characters which are present in some locales and corrupt formatting */
$escapedDateFormat = preg_replace('/[^MmDdYy\/\.\-]/', '', $dateFormat);

Expand Down Expand Up @@ -440,4 +441,19 @@ private function setTwoDayPlaces(string $format): string
$format
);
}

/**
* Set 2 places for month value in format string
*
* @param string $format
* @return string
*/
private function setTwoMonthPlaces(string $format): string
{
return preg_replace(
'/(?<!M)M(?!M)/',
'MM',
$format
);
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/Customer/Test/Mftf/Data/DateData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
<entity name="EN_US_DATE">
<data key="short">9/21/93</data>
<data key="short4DigitYear">9/21/1993</data>
<data key="short4DigitYear">09/21/1993</data>
<data key="medium">Sep 21, 1993</data>
<data key="long">September 21, 1993</data>
<data key="full">Tuesday, September 21, 1993</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class DobTest extends TestCase
private const YEAR = '2014';

// Value of date('Y', strtotime(self::DATE))
private const DATE_FORMAT = 'M/dd/y';
private const DATE_FORMAT = 'MM/dd/y';

/** Constants used by Dob::setDateInput($code, $html) */
private const DAY_HTML =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ define([

dataProvider = [
{
format: 'M/d/Y',
format: 'MM/d/Y',
date: '09/2/18',
expects: true
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ lib/web/mage/adminhtml/varienLoader.js
lib/web/magnifier/magnifier.js
lib/web/magnifier/magnify.js
lib/web/varien/js.js
lib/web/jquery/jquery.validate.js
lib/web/prototype/**/*.js

// MINIFIED FILES
app/code/**/*.min.js
lib/web/legacy-build.min.js

// TEST
vendor/magento/magento-coding-standard/Magento2/Tests/Eslint/*
10 changes: 1 addition & 9 deletions lib/internal/Magento/Framework/Amqp/Connection/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,7 @@ public function create(FactoryOptions $options): AbstractConnection
$parameters['ssl_options'] = $options->getSslOptions() !== null
? $options->getSslOptions()
: ['verify_peer' => true];
return ObjectManager::getInstance()->create($connectionType, $parameters);
}
// need to revert the changes in scope of this ticket - AC-11673
return new AMQPStreamConnection(
$parameters['host'],
$parameters['port'],
$parameters['user'],
$parameters['password'],
$parameters['vhost']
);
return ObjectManager::getInstance()->create($connectionType, $parameters);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ public static function connectionDataProvider()
'ssl_enabled' => true,
'connection_class' => AMQPSSLConnection::class,
],
// [ // Need to revert in scope of this ticket - AC-11673
// 'ssl_enabled' => false,
// 'connection_class' => AMQPStreamConnection::class,
// ],
[
'ssl_enabled' => false,
'connection_class' => AMQPStreamConnection::class,
],
];
}

Expand Down
67 changes: 53 additions & 14 deletions lib/web/jquery/jquery.validate.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*!
* jQuery Validation Plugin v1.19.5
* jQuery Validation Plugin v1.20.0
*
* https://jqueryvalidation.org/
*
* Copyright (c) 2022 Jörn Zaefferer
* Copyright (c) 2023 Jörn Zaefferer
* Released under the MIT license
*/
(function( factory ) {
Expand Down Expand Up @@ -775,6 +775,9 @@
val = this.elementValue( element ),
result, method, rule, normalizer;

// Abort any pending Ajax request from a previous call to this method.
this.abortRequest( element );

// Prioritize the local normalizer defined for this element over the global one
// if the former exists, otherwise user the global one in case it exists.
if ( typeof rules.normalizer === "function" ) {
Expand Down Expand Up @@ -961,14 +964,23 @@
error.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );

// Replace message on existing label
error.html( message );
if ( this.settings && this.settings.escapeHtml ) {
error.text( message || "" );
} else {
error.html( message || "" );
}
} else {

// Create error element
error = $( "<" + this.settings.errorElement + ">" )
.attr( "id", elementID + "-error" )
.addClass( this.settings.errorClass )
.html( message || "" );
.addClass( this.settings.errorClass );

if ( this.settings && this.settings.escapeHtml ) {
error.text( message || "" );
} else {
error.html( message || "" );
}

// Maintain reference to the element to be placed into the DOM
place = error;
Expand Down Expand Up @@ -1039,7 +1051,7 @@
// 'aria-describedby' should directly reference the error element
if ( describer ) {
selector = selector + ", #" + this.escapeCssMeta( describer )
.replace( /\s+/g, ", #" ) + ":visible";
.replace( /\s+/g, ", #" );
}

return this
Expand Down Expand Up @@ -1114,6 +1126,10 @@
return !$.validator.methods.required.call( this, val, element ) && "dependency-mismatch";
},

elementAjaxPort: function( element ) {
return "validate" + element.name;
},

startRequest: function( element ) {
if ( !this.pending[ element.name ] ) {
this.pendingRequest++;
Expand Down Expand Up @@ -1149,6 +1165,25 @@
}
},

abortRequest: function( element ) {
var port;

if ( this.pending[ element.name ] ) {
port = this.elementAjaxPort( element );
$.ajaxAbort( port );

this.pendingRequest--;

// Sometimes synchronization fails, make sure pendingRequest is never < 0
if ( this.pendingRequest < 0 ) {
this.pendingRequest = 0;
}

delete this.pending[ element.name ];
$( element ).removeClass( this.settings.pendingClass );
}
},

previousValue: function( element, method ) {
method = typeof method === "string" && method || "remote";

Expand Down Expand Up @@ -1600,7 +1635,7 @@
data[ element.name ] = value;
$.ajax( $.extend( true, {
mode: "abort",
port: "validate" + element.name,
port: this.elementAjaxPort( element ),
dataType: "json",
data: data,
context: validator.currentForm,
Expand All @@ -1611,7 +1646,6 @@
validator.settings.messages[ element.name ][ method ] = previous.originalMessage;
if ( valid ) {
submitted = validator.formSubmitted;
validator.resetInternals();
validator.toHide = validator.errorsFor( element );
validator.formSubmitted = submitted;
validator.successList.push( element );
Expand All @@ -1636,6 +1670,7 @@

// Ajax mode: abort
// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
// $.ajaxAbort( port );
// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()

var pendingRequests = {},
Expand All @@ -1646,9 +1681,7 @@
$.ajaxPrefilter( function( settings, _, xhr ) {
var port = settings.port;
if ( settings.mode === "abort" ) {
if ( pendingRequests[ port ] ) {
pendingRequests[ port ].abort();
}
$.ajaxAbort( port );
pendingRequests[ port ] = xhr;
}
} );
Expand All @@ -1660,14 +1693,20 @@
var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
port = ( "port" in settings ? settings : $.ajaxSettings ).port;
if ( mode === "abort" ) {
if ( pendingRequests[ port ] ) {
pendingRequests[ port ].abort();
}
$.ajaxAbort( port );
pendingRequests[ port ] = ajax.apply( this, arguments );
return pendingRequests[ port ];
}
return ajax.apply( this, arguments );
};
}

// Abort the previous request without sending a new one
$.ajaxAbort = function( port ) {
if ( pendingRequests[ port ] ) {
pendingRequests[ port ].abort();
delete pendingRequests[ port ];
}
};
return $;
}));
4 changes: 2 additions & 2 deletions lib/web/legacy-build.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/web/moment.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/web/prototype/prototype.js
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ Object.extend(String.prototype, (function () {
}

function stripTags() {
return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?(\/)?>|<\/\w+>/gi, '');
return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>'"])+)?\s*("[^">]*|'[^'>])?(\/)?>|<\/\w+>/gi, '');
}

function stripScripts() {
Expand Down

0 comments on commit de4dfb8

Please sign in to comment.