Skip to content

Commit 98ee601

Browse files
authored
Merge pull request #408 from cloudinary/fix/deactivation-confirm
Fix deactivation confirm
2 parents ce039f2 + 5940cbc commit 98ee601

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

js/deactivate.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '88e240911a2b640cef23c165ef78879b');
1+
<?php return array('dependencies' => array('wp-polyfill'), 'version' => 'e862bb5e9c2155662e26dab8ad582baa');

js/deactivate.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/src/deactivate.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const Deactivate = {
77
pluginListLinks: document.querySelectorAll(
88
'.cld-deactivate-link, .cld-deactivate'
99
),
10+
// The deactivation links when Cloudinary only is set for storage.
11+
triggers: document.getElementsByClassName( 'cld-deactivate' ),
1012
// The reasons.
1113
options: document.querySelectorAll(
1214
'.cloudinary-deactivation input[type="radio"]'
@@ -53,6 +55,24 @@ const Deactivate = {
5355
} );
5456
} );
5557

58+
// Add it a trigger watch to stop deactivation.
59+
[ ...context.triggers ].forEach( ( trigger ) => {
60+
trigger.addEventListener( 'click', function ( ev ) {
61+
if (
62+
! confirm(
63+
wp.i18n.__(
64+
'Caution: Your storage setting is currently set to "Cloudinary only", disabling the plugin will result in broken links to media assets. Are you sure you want to continue?',
65+
'cloudinary'
66+
)
67+
)
68+
) {
69+
ev.preventDefault();
70+
// Close the feedback form.
71+
document.getElementById( 'TB_closeWindowButton' ).click();
72+
}
73+
} );
74+
} );
75+
5676
// Add event listener to skip feedback.
5777
context.skipButton.addEventListener( 'click', function () {
5878
window.location.href = context.deactivationUrl;

0 commit comments

Comments
 (0)