Skip to content

Commit 4dce1e6

Browse files
Merge pull request #9438 from jrafanie/revert-jquery-371-upgrade
Revert jquery 3.7.1 upgrade
2 parents 0cfaf99 + 825c5d6 commit 4dce1e6

File tree

12 files changed

+32
-40
lines changed

12 files changed

+32
-40
lines changed

.yarnrc.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,10 @@ npmAuditExcludePackages:
1919
# pending | moderate | GHSA-9mvj-f7w8-pvh2 | bootstrap >=2.0.0 <=3.4.1 | 3.4.1 brought in by eonasdan-bootstrap-datetimepicker@virtual:6557af66f1a3f9d81b30dd080e0c619c011728fa0bded31959e34111c8a06d5f82c760d19a3100c59f98831cc7e73d48a91c41d41de6db59b14a282cb6169d79#npm:4.17.49
2020
- bootstrap-sass
2121
# pending | moderate | GHSA-9mvj-f7w8-pvh2 | bootstrap-sass >=2.0.0 <=3.4.3 | 3.4.3 brought in by patternfly@npm:3.59.5
22+
- jquery
23+
# pending | moderate | GHSA-rmxg-73gg-4p98 | jquery >=1.12.3 <3.0.0 | 2.2.4 brought in by manageiq-ui-classic@workspace:.
24+
# pending | moderate | GHSA-gxr4-xjj5-5px2 | jquery >=1.2.0 <3.5.0 | 2.2.4, 3.4.1 brought in by manageiq-ui-classic@workspace:., patternfly@npm:3.59.5
25+
# pending | moderate | GHSA-6c3j-c64m-qhgq | jquery >=1.1.4 <3.4.0 | 2.2.4 brought in by manageiq-ui-classic@workspace:.
26+
# pending | moderate | GHSA-jpcq-cgw6-v4j6 | jquery >=1.0.3 <3.5.0 | 2.2.4, 3.4.1 brought in by manageiq-ui-classic@workspace:., patternfly@npm:3.59.5
2227

2328
yarnPath: .yarn/releases/yarn-4.9.1.cjs

app/javascript/oldjs/import.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ window.ImportSetup = {
6565
listenForGitPostMessages: function() {
6666
window.addEventListener('message', function(event) {
6767
var messageData = event.data.message;
68-
if (messageData && messageData.level === 'error') {
68+
69+
if (messageData.level === 'error') {
6970
showErrorMessage(messageData.message);
7071
$('#git-url-import').prop('disabled', null);
7172
} else if (event.data.git_branches || event.data.git_tags) {

app/javascript/oldjs/jquery_overrides.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,6 @@ jQuery.jsonPayload = function(text, fallback) {
2424
};
2525

2626
$.ajaxSetup({
27-
/* Define two script converters:
28-
29-
1) script - This is the original converter to evaluate scripts for successful responses.
30-
2) miq_script - Define a duplicate but differently named script converter whose purpose is to
31-
evaluate scripts for unsuccessful ajax responses. jQuery 3.5.0 changed the behavior of the script
32-
converter, replacing it with a no-op converter for scripts found in unsuccessful ajax responses.
33-
Successful responses would continue to be evaluated as previously.
34-
See: https://github.com/jquery/jquery/commit/da3dd85b63c4e3a6a768132c2a83a1a6eec24840
35-
36-
Due to this change starting in 3.5.0, we define a new type of script we can set as the dataType
37-
so it's evaluated in the event of unsuccessful responses such as the SSO 401 unauthorized
38-
issue we attempted to fix in #9410 and subsequently completed in #9426.
39-
*/
4027
accepts: {
4128
json: 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript',
4229
},
@@ -49,15 +36,6 @@ $.ajaxSetup({
4936
return jQuery.parseJSON(text);
5037
});
5138
}),
52-
'text miq_script': logError(function(text) {
53-
if (text.match(/^{/)) {
54-
return jQuery.jsonPayload(text, function(text) {
55-
return text;
56-
});
57-
} // JavaScript payload
58-
jQuery.globalEval(text.slice('throw "error";'.length));
59-
return text;
60-
}),
6139
'text script': logError(function(text) {
6240
if (text.match(/^{/)) {
6341
return jQuery.jsonPayload(text, function(text) {

app/javascript/oldjs/miq_application.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,8 +1091,8 @@ window.miqJqueryRequest = function(url, options) {
10911091
};
10921092

10931093
if (options.dataType === undefined) {
1094-
ajax_options.accepts = { miq_script: `*/*;q=0.5, ${$.ajaxSettings.accepts.script}` };
1095-
ajax_options.dataType = 'miq_script';
1094+
ajax_options.accepts = { script: `*/*;q=0.5, ${$.ajaxSettings.accepts.script}` };
1095+
ajax_options.dataType = 'script';
10961096
}
10971097

10981098
// copy selected options over

app/javascript/spec/ops-tenant-form/ops-tenant-form.spec.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ describe('OpstTenantForm', () => {
5252
});
5353

5454
it('should mount and set initialValues', async(done) => {
55-
fetchMock.getOnce('/api/tenants?filter[]=name=&expand=resources', {
56-
resources: [],
57-
});
5855
fetchMock.getOnce('/api/tenants/123?expand=resources&attributes=name,description,use_config_for_attributes,ancestry,divisible', {
5956
name: 'foo',
6057
});

config/jest.setup.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,7 @@ ManageIQ.redux.store.injectReducers();
5353

5454
Object.defineProperty(Array.prototype, 'flat', {
5555
value: function(depth = 1) {
56-
let array = this;
57-
if (typeof this === 'object') {
58-
array = Object.keys(this).map((key) => this[key])
59-
}
60-
return array.reduce(function (flat, toFlatten) {
56+
return this.reduce(function (flat, toFlatten) {
6157
return flat.concat((Array.isArray(toFlatten) && (depth>1)) ? toFlatten.flat(depth-1) : toFlatten);
6258
}, []);
6359
}

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"eonasdan-bootstrap-datetimepicker": "~4.17.49",
7373
"es6-shim": "~0.35.3",
7474
"history": "^4.7.2",
75-
"jquery": "~3.7.1",
75+
"jquery": "~2.2.4",
7676
"jquery-ui": "~1.13.2",
7777
"jquery-ujs": "~1.2.2",
7878
"jquery.hotkeys": "~0.1.0",
@@ -190,7 +190,6 @@
190190
"cross-spawn": "~7.0.5",
191191
"decode-uri-component": "^0.2.2",
192192
"express": "^4.18.2",
193-
"jquery": "~3.7.1",
194193
"lodash": "~4.17.21",
195194
"minimatch": "~3.1.2",
196195
"moment": "^2.30.1",

spec/javascripts/automate_import_export_spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ describe('Automate', function() {
263263
it('refreshes the selectpicker for git-branches and git-tags', function() {
264264
Automate.renderGitImport(['branches'], ['tags'], '123', {message: 'the message', level: 'warning'});
265265
expect($.fn.selectpicker.calls.allArgs()).toEqual([['refresh'], ['refresh']]);
266-
expect($.fn.selectpicker.calls.first().object[0].className).toEqual('git-branches');
267-
expect($.fn.selectpicker.calls.mostRecent().object[0].className).toEqual('git-tags');
266+
expect($.fn.selectpicker.calls.first().object.selector).toEqual('select.git-branches');
267+
expect($.fn.selectpicker.calls.mostRecent().object.selector).toEqual('select.git-tags');
268268
});
269269
});
270270

spec/javascripts/import_spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ describe('import.js', function() {
120120

121121
it('disables the git-url-import', function() {
122122
expect($.fn.prop).toHaveBeenCalledWith('disabled', null);
123+
expect($.fn.prop.calls.mostRecent().object.selector).toEqual('#git-url-import');
123124
});
124125

125126
it('turns the spinner off', function() {

spec/javascripts/miq_application_spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe('miq_application.js', function() {
66
});
77

88
it('verify serialize method doesnt convert line feed value to windows line feed', function() {
9-
expect(miqSerializeForm('form_div')).toEqual('method_data=new%20line%20added%0A%0A');
9+
expect(miqSerializeForm('form_div')).toEqual("method_data=new+line+added%0A%0A");
1010
});
1111
});
1212

0 commit comments

Comments
 (0)