Skip to content

Commit 28d4cac

Browse files
authored
Merge pull request #530 from atlassian-labs/issue/DCA11Y-2547-migrate-to-jquery-4
DCA11Y-2547 support jquery 4
2 parents 94c50dc + c262031 commit 28d4cac

23 files changed

Lines changed: 126 additions & 79 deletions

File tree

bitbucket-slack-server-integration-plugin/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
<atlassian.spring.scanner.version>6.0.0</atlassian.spring.scanner.version>
5555
<atlassian.selenium.version>4.0.0</atlassian.selenium.version>
5656
<atlassian.plugin.point.safety.version>1.0.0</atlassian.plugin.point.safety.version>
57+
<atlassian.plugin.jquery.version>4.0.0-m004</atlassian.plugin.jquery.version>
5758
<junit.jupiter.version>5.13.4</junit.jupiter.version>
5859
<mockito-core.version>5.21.0</mockito-core.version>
5960
<commons-codec.version>1.11</commons-codec.version>
@@ -554,6 +555,13 @@
554555
</feManifestAssociation>
555556
</feManifestAssociations>
556557

558+
<pluginArtifacts>
559+
<pluginArtifact>
560+
<groupId>com.atlassian.plugins</groupId>
561+
<artifactId>jquery</artifactId>
562+
<version>${atlassian.plugin.jquery.version}</version>
563+
</pluginArtifact>
564+
</pluginArtifacts>
557565
<systemPropertyVariables>
558566
<plugin.resource.directories>
559567
${project.basedir}/../slack-server-integration-common/src/main/resources,
@@ -567,6 +575,8 @@
567575
<discovery.test.mode>true</discovery.test.mode>
568576
<atlassian.test.target.dir>${project.build.directory}/webdriverTests</atlassian.test.target.dir>
569577
<atlassian.authentication.legacy.mode>true</atlassian.authentication.legacy.mode>
578+
<!-- Enable once products support jQuery 4 -->
579+
<!-- <atlassian.darkfeature.plugins.jquery.migrate.disable>true</atlassian.darkfeature.plugins.jquery.migrate.disable> -->
570580
</systemPropertyVariables>
571581

572582
<instructions>

bitbucket-slack-server-integration-plugin/src/main/resources/slack-static/feature/channel-selector/bitbucket-slack-repository-to-channel-internal-ui.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,18 @@ require([
105105
};
106106

107107
var enableAddChannelButton = function() {
108-
$('#slack-repository-to-channel-add').removeAttr('aria-disabled').removeAttr('disabled')
108+
$('#slack-repository-to-channel-add').removeAttr('aria-disabled').prop('disabled', false);
109109
};
110110

111111
var updateAddMappingButtonEnablement = function (channelService) {
112112
var addChannelButton = $('#slack-repository-to-channel-add');
113113
var selectedChannel = getSelectedChannel();
114114
if (getSelectedRepository() && selectedChannel && channelService.allowSelectionByName(selectedChannel.channelName)) {
115-
addChannelButton.removeAttr('aria-disabled').removeAttr('disabled')
115+
addChannelButton.removeAttr('aria-disabled').prop('disabled', false);
116116
} else {
117117
addChannelButton.attr({
118118
'aria-disabled': 'true',
119-
'disabled': ''
119+
'disabled': 'disabled'
120120
});
121121
}
122122
};
@@ -259,7 +259,7 @@ require([
259259
config.spinStop();
260260
config.remove();
261261
}).fail(function (jqXHR, textStatus, errorThrown) {
262-
config.find('input').removeAttr('disabled');
262+
config.find('input').prop('disabled', false);
263263
config.spinStop();
264264
displayUpdateConfigurationError(jqXHR.status, jqXHR.statusText);
265265
});
@@ -316,12 +316,12 @@ require([
316316
var spinner = $("#slack-repository-to-channel-add-mapping-spinner").spin();
317317
channelService.getOrCreateChannel(selectedChannel)
318318
.done(function (channel) {
319-
addChannelButton.removeAttr('disabled');
319+
addChannelButton.prop('disabled', false);
320320
spinner.spinStop();
321321
addChannelMapping(channel);
322322
})
323323
.fail(function (newChannelName, statusCode, statusText) {
324-
addChannelButton.removeAttr('disabled');
324+
addChannelButton.prop('disabled', false);
325325
spinner.spinStop();
326326
displayError(AJS.I18n.getText("slack2-repository-configuration.select.channel.create.error.title", newChannelName), statusCode, statusText);
327327
});
@@ -444,14 +444,14 @@ require([
444444
});
445445
}
446446

447-
$('#slack-repository-to-channel-add').click(addChannelMappingHandler);
447+
$('#slack-repository-to-channel-add').on('click', addChannelMappingHandler);
448448

449449
$('#slack-channel-configuration')
450-
.delegate('.edit-notification', 'click', editRepositoryChannelNotificationConfigLinkHandler)
451-
.delegate('.close-edit-notification', 'click', closeRepositoryChannelNotificationConfig)
452-
.delegate('.trash-channel-mapping', 'click', deleteRepositoryChannelNotificationConfig)
453-
.delegate('.notification-type', 'click', toggleRepositoryChannelNotificationType)
454-
.delegate('.notification-option', 'click', saveRepositoryChannelOption);
450+
.on('click', '.edit-notification', editRepositoryChannelNotificationConfigLinkHandler)
451+
.on('click', '.close-edit-notification', closeRepositoryChannelNotificationConfig)
452+
.on('click', '.trash-channel-mapping', deleteRepositoryChannelNotificationConfig)
453+
.on('click', '.notification-type', toggleRepositoryChannelNotificationType)
454+
.on('click', '.notification-option', saveRepositoryChannelOption);
455455
});
456456

457457
});

confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,16 @@
272272
<artifactId>confluence-webdriver-pageobjects</artifactId>
273273
<version>15.0.2</version>
274274
<scope>test</scope>
275+
<exclusions>
276+
<exclusion>
277+
<groupId>com.atlassian.confluence</groupId>
278+
<artifactId>confluence-java-api</artifactId>
279+
</exclusion>
280+
<exclusion>
281+
<groupId>com.atlassian.confluence</groupId>
282+
<artifactId>confluence-rest-client-jakarta</artifactId>
283+
</exclusion>
284+
</exclusions>
275285
</dependency>
276286
<!-- Transitive confluence-rest-client-jakarta from confluence-webdriver-pageobjects:15.0.2 is publicly unavailable -->
277287
<dependency>
@@ -319,6 +329,7 @@
319329
<exclude>com.atlassian.security:atlassian-secure-random</exclude>
320330
<exclude>com.google.code.gson:gson</exclude>
321331
<exclude>net.bytebuddy:byte-buddy</exclude>
332+
<exclude>commons-beanutils:commons-beanutils</exclude>
322333
</banningExcludes>
323334

324335
<!-- Custom logging config to show logs from plugin classes by default -->
@@ -348,6 +359,13 @@
348359
</feManifestAssociation>
349360
</feManifestAssociations>
350361

362+
<pluginArtifacts>
363+
<pluginArtifact>
364+
<groupId>com.atlassian.plugins</groupId>
365+
<artifactId>jquery</artifactId>
366+
<version>${atlassian.plugin.jquery.version}</version>
367+
</pluginArtifact>
368+
</pluginArtifacts>
351369
<systemPropertyVariables combine.children="append">
352370
<plugin.resource.directories>
353371
${plugin.parent.directory}/slack-server-integration-common/src/main/resources,
@@ -363,6 +381,8 @@
363381
<!-- This disables the Post Upgrade Landing Page, which we never want showing up in tests -->
364382
<atlassian.darkfeature.pulp>false</atlassian.darkfeature.pulp>
365383
<atlassian.authentication.legacy.mode>true</atlassian.authentication.legacy.mode>
384+
<!-- Enable once products support jQuery 4 -->
385+
<!-- <atlassian.darkfeature.plugins.jquery.migrate.disable>true</atlassian.darkfeature.plugins.jquery.migrate.disable> -->
366386
</systemPropertyVariables>
367387
<instructions>
368388
<Atlassian-Plugin-Key>${plugin.key}</Atlassian-Plugin-Key>

confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/resources/js/confluence-slack-status.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ require([
3333
// When user link is in a inline popup (.ajs-content-hover class), clicks are not propagated
3434
// to our root document node listener due to a Confluence script, so delegating listener does not work
3535
// So here a click listener added directly to link node
36-
$slackIcon.click(handleSlackUserLinkClicked);
36+
$slackIcon.on('click', handleSlackUserLinkClicked);
3737
} else if (response.length > 1) {
3838
$slackIcon = $(Confluence.Templates.Slack.User.slackIcon({
3939
slackUsers: response
4040
}));
41-
$slackIcon.click(function(event) {
41+
$slackIcon.on('click', function(event) {
4242
event.preventDefault();
4343
});
4444

@@ -48,7 +48,7 @@ require([
4848
var $slackSection = $(slackSectionMarkup);
4949
var $popupMenu = $vcard.closest('.contents').find('#user-popup-menu-admin-secondary');
5050
$popupMenu.append($slackSection);
51-
$popupMenu.find('.slack-user-link-url').click(handleSlackUserLinkClicked);
51+
$popupMenu.find('.slack-user-link-url').on('click', handleSlackUserLinkClicked);
5252
}
5353
$vcard.find('h4').append($slackIcon);
5454
});

confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/resources/js/spacetochannel/confluence-slack-space-to-channel-internal-ui.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,18 @@ require([
124124
};
125125

126126
var enableAddChannelButton = function() {
127-
$('#slack-space-to-channel-add').removeAttr('aria-disabled').removeAttr('disabled')
127+
$('#slack-space-to-channel-add').removeAttr('aria-disabled').prop('disabled', false);
128128
};
129129

130130
var updateAddMappingButtonEnablement = function (channelService) {
131131
var addChannelButton = $('#slack-space-to-channel-add');
132132
var selectedChannel = getSelectedChannel();
133133
if (getSelectedSpace && selectedChannel && channelService.allowSelectionByName(selectedChannel.channelName)) {
134-
addChannelButton.removeAttr('aria-disabled').removeAttr('disabled')
134+
addChannelButton.removeAttr('aria-disabled').prop('disabled', false);
135135
} else {
136136
addChannelButton.attr({
137137
'aria-disabled': 'true',
138-
'disabled': ''
138+
'disabled': 'disabled'
139139
});
140140
}
141141
};
@@ -264,7 +264,7 @@ require([
264264
config.spinStop();
265265
config.remove();
266266
}).fail(function (jqXHR, textStatus, errorThrown) {
267-
config.find('input').removeAttr('disabled');
267+
config.find('input').prop('disabled', false);
268268
config.spinStop();
269269
displayUpdateConfigurationError(jqXHR.status, jqXHR.statusText);
270270
});
@@ -321,12 +321,12 @@ require([
321321
var spinner = $("#slack-space-to-channel-add-mapping-spinner").spin();
322322
channelService.getOrCreateChannel(selectedChannel)
323323
.done(function (channel) {
324-
addChannelButton.removeAttr('disabled');
324+
addChannelButton.prop('disabled', false);
325325
spinner.spinStop();
326326
addChannelMapping(channel);
327327
})
328328
.fail(function (newChannelName, statusCode, statusText) {
329-
addChannelButton.removeAttr('disabled');
329+
addChannelButton.prop('disabled', false);
330330
spinner.spinStop();
331331
displayError(AJS.I18n.getText("slack2-space-configuration.select.channel.create.error.title", newChannelName), statusCode, statusText);
332332
});
@@ -429,13 +429,13 @@ require([
429429
});
430430
}
431431

432-
$('#slack-space-to-channel-add').click(addChannelMappingHandler);
432+
$('#slack-space-to-channel-add').on('click', addChannelMappingHandler);
433433

434434
$('#slack-space-to-channel-configuration')
435-
.delegate('.edit-notification', 'click', editSpaceChannelNotificationConfigLinkHandler)
436-
.delegate('.close-edit-notification', 'click', closeSpaceChannelNotificationConfig)
437-
.delegate('.trash-channel-mapping', 'click', deleteSpaceChannelNotificationConfig)
438-
.delegate('.notification-type', 'click', toggleSpaceChannelNotificationType);
435+
.on('click', '.edit-notification', editSpaceChannelNotificationConfigLinkHandler)
436+
.on('click', '.close-edit-notification', closeSpaceChannelNotificationConfig)
437+
.on('click', '.trash-channel-mapping', deleteSpaceChannelNotificationConfig)
438+
.on('click', '.notification-type', toggleSpaceChannelNotificationType);
439439
});
440440

441441
});

jira-slack-server-integration/jira-slack-server-integration-plugin/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,11 @@
403403
<artifactId>jira-testkit-plugin</artifactId>
404404
<version>${testkit.version}</version>
405405
</pluginArtifact>
406+
<pluginArtifact>
407+
<groupId>com.atlassian.plugins</groupId>
408+
<artifactId>jquery</artifactId>
409+
<version>${atlassian.plugin.jquery.version}</version>
410+
</pluginArtifact>
406411
</pluginArtifacts>
407412

408413
<includedFeModuleManifests>
@@ -430,6 +435,8 @@
430435
<discovery.test.mode>true</discovery.test.mode>
431436
<atlassian.test.target.dir>${project.build.directory}/webdriverTests</atlassian.test.target.dir>
432437
<atlassian.authentication.legacy.mode>true</atlassian.authentication.legacy.mode>
438+
<!-- Enable once products support jQuery 4 -->
439+
<!-- <atlassian.darkfeature.plugins.jquery.migrate.disable>true</atlassian.darkfeature.plugins.jquery.migrate.disable> -->
433440
</systemPropertyVariables>
434441

435442
<instructions>

jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/resources/js/jira-slack-status.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ require([
3333
$slackIcon = $(Jira.Templates.Slack.User.slackIcon({
3434
slackUsers: response
3535
}));
36-
$slackIcon.click(function(event) {
36+
$slackIcon.on('click', function(event) {
3737
event.preventDefault(); // do not redirect to Slack - user should select team first
3838
});
3939

jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/resources/js/migrate-to-slack.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@ require([
128128

129129
function enableDialogSubmit() {
130130
$(dialogSubmitSelector)
131-
.removeAttr('aria-disabled').removeAttr('disabled');
131+
.removeAttr('aria-disabled').prop('disabled', false);
132132
}
133133

134134
function disableDialogSubmit() {
135135
$('#slack-migrate-select-channel-dialog-submit').attr({
136136
'aria-disabled': 'true',
137-
'disabled': ''
137+
'disabled': 'disabled'
138138
});
139139
}
140140

@@ -312,7 +312,7 @@ require([
312312
dialog.show();
313313
});
314314

315-
$(document).bind("dialogContentReady", {}, dialogContentReadyCallback);
315+
$(document).on("dialogContentReady", dialogContentReadyCallback);
316316
});
317317

318318
}

jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/resources/js/mute-bulk-edit-notifications-toggle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ require([
2424
datatype: 'json'
2525
}).fail(function(jqXHR, textStatus, error) {
2626
console.error('Failed to get Slack bulk edit mute notifications toggle value', error);
27-
}).success(function(data) {
27+
}).done(function(data) {
2828
var checkedByDefault = data.muted ? 'checked' : '';
2929

3030
$('#bulkedit p:last').before(
@@ -35,7 +35,7 @@ require([
3535
'</div>'
3636
);
3737

38-
$('#' + muteBulkNotificationsInputId).change(function (event) {
38+
$('#' + muteBulkNotificationsInputId).on('change', function (event) {
3939
var isChecked = $(this).is(':checked');
4040
var muteLabel = isChecked ? 'mute' : 'unmute';
4141
$.ajax({

jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/resources/js/slack-feature/channelmapping/channelmapping-page.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ define("slack/feature/channelmapping/channelmapping-page",
6666
var projectName = self.getProjectNameFromField() || '';
6767
var parentheses = projectName.indexOf('(');
6868
if (parentheses > 0) {
69-
projectName = $.trim(projectName.substring(0, parentheses));
69+
projectName = projectName.substring(0, parentheses).trim();
7070
}
7171
return projectName;
7272
}
@@ -108,14 +108,14 @@ define("slack/feature/channelmapping/channelmapping-page",
108108
var selectedChannel = this.channelSelector.getSelectedChannel();
109109
var selectedProject = this.getProjectNameFromField();
110110
if (selectedChannel.id !== "" && selectedProject !== "") {
111-
this.$("#slack-project-to-channel-add").removeAttr('aria-disabled').removeAttr('disabled');
111+
this.$("#slack-project-to-channel-add").removeAttr('aria-disabled').prop('disabled', false);
112112
}
113113
},
114114

115115
disableAddButton: function() {
116116
this.$('#slack-project-to-channel-add').attr({
117117
'aria-disabled': 'true',
118-
'disabled': ''
118+
'disabled': 'disabled'
119119
});
120120
},
121121

0 commit comments

Comments
 (0)