Skip to content

Commit 2c03a3b

Browse files
authored
Merge pull request #982 from cloudinary/hotfix/3.2.1-build-1
Improves the workflow for updating the connection string
2 parents 4b1fc34 + b474cfa commit 2c03a3b

File tree

9 files changed

+76
-49
lines changed

9 files changed

+76
-49
lines changed

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2.1-build-1
1+
3.2.1-build-2

js/cloudinary.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.

languages/cloudinary.pot

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ msgid ""
44
msgstr ""
55
"Project-Id-Version: Cloudinary STABLETAG\n"
66
"Report-Msgid-Bugs-To: https://github.com/cloudinary/cloudinary_wordpress\n"
7-
"POT-Creation-Date: 2024-09-17 17:28:45+00:00\n"
7+
"POT-Creation-Date: 2024-09-18 11:55:33+00:00\n"
88
"MIME-Version: 1.0\n"
99
"Content-Type: text/plain; charset=utf-8\n"
1010
"Content-Transfer-Encoding: 8bit\n"
@@ -218,46 +218,46 @@ msgstr ""
218218
msgid "Enable caching site assets."
219219
msgstr ""
220220

221-
#: php/class-connect.php:264
221+
#: php/class-connect.php:266
222222
msgid "Connection to Cloudinary has been removed."
223223
msgstr ""
224224

225-
#: php/class-connect.php:285
225+
#: php/class-connect.php:287
226226
msgid ""
227227
"The environment variable URL must be in this format: "
228228
"cloudinary://API_KEY:API_SECRET@CLOUD_NAME"
229229
msgstr ""
230230

231-
#: php/class-connect.php:306
231+
#: php/class-connect.php:308
232232
msgid "Successfully connected to Cloudinary."
233233
msgstr ""
234234

235-
#: php/class-connect.php:350
235+
#: php/class-connect.php:352
236236
#. translators: Placeholder refers the error from API.
237237
msgid "Cloudinary Error: %s"
238238
msgstr ""
239239

240-
#: php/class-connect.php:358
240+
#: php/class-connect.php:360
241241
#. translators: Placeholders are <a> tags.
242242
msgid ""
243243
"Cloudinary Account Disabled. %1$s Upgrade your plan %3$s or %2$s submit a "
244244
"support request %3$s for assistance."
245245
msgstr ""
246246

247-
#: php/class-connect.php:403
247+
#: php/class-connect.php:405
248248
#. translators: Placeholder refers to the expected URL format.
249249
msgid "Incorrect Format. Expecting: %s"
250250
msgstr ""
251251

252-
#: php/class-connect.php:415
252+
#: php/class-connect.php:417
253253
msgid "CNAME is not a valid domain name."
254254
msgstr ""
255255

256-
#: php/class-connect.php:805
256+
#: php/class-connect.php:807
257257
msgid "upgrade your account"
258258
msgstr ""
259259

260-
#: php/class-connect.php:820
260+
#: php/class-connect.php:822
261261
#. translators: %1$s quota size, %2$s amount in percent, %3$s link URL, %4$s
262262
#. link anchor text.
263263
msgid ""
@@ -269,11 +269,11 @@ msgid ""
269269
"full functionality."
270270
msgstr ""
271271

272-
#: php/class-connect.php:1015
272+
#: php/class-connect.php:1017
273273
msgid "Cloudinary was able to connect to the WordPress REST API."
274274
msgstr ""
275275

276-
#: php/class-connect.php:1032 php/class-connect.php:1042
276+
#: php/class-connect.php:1034 php/class-connect.php:1044
277277
#. translators: 1: The WordPress error message. 2: The WordPress error code.
278278
msgid "The Cloudinary REST API endpoints are not available. Error: %1$s (%2$s)"
279279
msgstr ""
@@ -513,59 +513,59 @@ msgid ""
513513
"WordPress."
514514
msgstr ""
515515

516-
#: php/class-media.php:2048
516+
#: php/class-media.php:2049
517517
msgid "Import"
518518
msgstr ""
519519

520520
#. Plugin Name of the plugin/theme
521521
msgid "Cloudinary"
522522
msgstr ""
523523

524-
#: php/class-media.php:2404
524+
#: php/class-media.php:2405
525525
msgid "The delivery for this asset is disabled."
526526
msgstr ""
527527

528-
#: php/class-media.php:2408
528+
#: php/class-media.php:2409
529529
msgid "Not syncable. This is an external media."
530530
msgstr ""
531531

532-
#: php/class-media.php:2412
532+
#: php/class-media.php:2413
533533
msgid "This media is Fetch type."
534534
msgstr ""
535535

536-
#: php/class-media.php:2416
536+
#: php/class-media.php:2417
537537
msgid "This media is Sprite type."
538538
msgstr ""
539539

540-
#: php/class-media.php:2426
540+
#: php/class-media.php:2427
541541
msgid "Not Synced"
542542
msgstr ""
543543

544-
#: php/class-media.php:2431
544+
#: php/class-media.php:2432
545545
msgid "Synced"
546546
msgstr ""
547547

548-
#: php/class-media.php:3082
548+
#: php/class-media.php:3083
549549
msgid "No Cloudinary filters"
550550
msgstr ""
551551

552-
#: php/class-media.php:3182
552+
#: php/class-media.php:3183
553553
msgid "Media Settings"
554554
msgstr ""
555555

556-
#: php/class-media.php:3185
556+
#: php/class-media.php:3186
557557
msgid "Media Display"
558558
msgstr ""
559559

560-
#: php/class-media.php:3189 php/media/class-global-transformations.php:620
560+
#: php/class-media.php:3190 php/media/class-global-transformations.php:620
561561
#: php/ui/component/class-asset-preview.php:73
562562
#: php/ui/component/class-plan-details.php:119
563563
#: php/ui/component/class-plan-status.php:128
564564
#: ui-definitions/settings-sidebar.php:44
565565
msgid "Transformations"
566566
msgstr ""
567567

568-
#: php/class-media.php:3190
568+
#: php/class-media.php:3191
569569
msgid ""
570570
"Cloudinary allows you to easily transform your images on-the-fly to any "
571571
"required format, style and dimension, and also optimizes images for minimal "
@@ -574,7 +574,7 @@ msgid ""
574574
"transformation and delivery URLs."
575575
msgstr ""
576576

577-
#: php/class-media.php:3195 ui-definitions/settings-image.php:164
577+
#: php/class-media.php:3196 ui-definitions/settings-image.php:164
578578
#: ui-definitions/settings-video.php:250
579579
msgid "See examples"
580580
msgstr ""
@@ -1714,56 +1714,60 @@ msgstr ""
17141714
msgid "Update the connection string"
17151715
msgstr ""
17161716

1717-
#: ui-definitions/components/wizard.php:146
1717+
#: ui-definitions/components/wizard.php:145
1718+
msgid "Cancel the update"
1719+
msgstr ""
1720+
1721+
#: ui-definitions/components/wizard.php:147
17181722
msgid "Connected!"
17191723
msgstr ""
17201724

1721-
#: ui-definitions/components/wizard.php:149
1725+
#: ui-definitions/components/wizard.php:150
17221726
msgid "Incorrect connection string"
17231727
msgstr ""
17241728

1725-
#: ui-definitions/components/wizard.php:160
1729+
#: ui-definitions/components/wizard.php:161
17261730
msgid "We collected some basic settings for you"
17271731
msgstr ""
17281732

1729-
#: ui-definitions/components/wizard.php:164
1733+
#: ui-definitions/components/wizard.php:165
17301734
msgid ""
17311735
"The options below help to optimize all of your assets, we recommend leaving "
17321736
"them on for the most optimal site performance. Click next to complete your "
17331737
"setup, the plugin will begin syncing your assets to Cloudinary and your "
17341738
"website will start being fast, optimized and responsive."
17351739
msgstr ""
17361740

1737-
#: ui-definitions/components/wizard.php:183
1741+
#: ui-definitions/components/wizard.php:184
17381742
msgid "All set! We're starting to sync your files to Cloudinary"
17391743
msgstr ""
17401744

1741-
#: ui-definitions/components/wizard.php:187
1745+
#: ui-definitions/components/wizard.php:188
17421746
msgid ""
17431747
"You have successfully set up the Cloudinary plugin for your site, your "
17441748
"media assets will now be optimized and delivered via fast CDN. To further "
17451749
"configure the plugin, take a look at the various settings available."
17461750
msgstr ""
17471751

1748-
#: ui-definitions/components/wizard.php:194
1752+
#: ui-definitions/components/wizard.php:195
17491753
msgid ""
17501754
"Once your assets have finished syncing, the plugin dashboard will show the "
17511755
"impact on performance for your site."
17521756
msgstr ""
17531757

1754-
#: ui-definitions/components/wizard.php:196
1758+
#: ui-definitions/components/wizard.php:197
17551759
msgid "Go to plugin dashboard"
17561760
msgstr ""
17571761

1758-
#: ui-definitions/components/wizard.php:202
1762+
#: ui-definitions/components/wizard.php:203
17591763
msgid "Click the lock to make changes"
17601764
msgstr ""
17611765

1762-
#: ui-definitions/components/wizard.php:206
1766+
#: ui-definitions/components/wizard.php:207
17631767
msgid "Back"
17641768
msgstr ""
17651769

1766-
#: ui-definitions/components/wizard.php:207
1770+
#: ui-definitions/components/wizard.php:208
17671771
msgid "Next"
17681772
msgstr ""
17691773

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,5 @@
150150
"webpack-cli": "^4.2.0",
151151
"webpackbar": "^5.0.2"
152152
},
153-
"version": "3.2.1-build-1"
153+
"version": "3.2.1-build-2"
154154
}

php/class-connect.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,10 @@ public function rest_save_wizard( WP_REST_Request $request ) {
179179
$advanced = true === $request->get_param( 'advanced' ) ? 'on' : 'off';
180180

181181
// Cloudinary URL.
182-
$connect = $this->settings->get_setting( 'cloudinary_url' );
183-
$connect->set_pending( $url );
182+
if ( ! empty( $url ) && true !== $url ) {
183+
$connect = $this->settings->get_setting( 'cloudinary_url' );
184+
$connect->set_pending( $url );
185+
}
184186

185187
// Autosync setup.
186188
$autosync = $this->settings->get_setting( 'auto_sync' );

php/class-media.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,8 @@ public function prepare_size( $attachment_id, $size ) {
15491549
}
15501550
} elseif ( is_string( $size ) || ( is_array( $size ) && 3 === count( $size ) ) ) {
15511551
$intermediate = image_get_intermediate_size( $attachment_id, $size );
1552-
if ( is_array( $intermediate ) ) {
1552+
// PDF's do not have intermediate URL.
1553+
if ( is_array( $intermediate ) && ! empty( $intermediate['url'] ) ) {
15531554
$size = $this->get_crop( $intermediate['url'], $attachment_id );
15541555
}
15551556
} elseif ( array_keys( $size ) === array( 0, 1 ) ) {

src/js/components/wizard.js

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ const Wizard = {
3030
working: document.getElementById( 'connection-working' ),
3131
},
3232
debounceConnect: null,
33+
updateConnection: document.getElementById( 'update-connection' ),
34+
cancelUpdateConnection: document.getElementById(
35+
'cancel-update-connection'
36+
),
3337
config: {},
38+
didSave: false,
3439
init() {
3540
if ( ! cldData.wizard ) {
3641
return;
@@ -55,12 +60,23 @@ const Wizard = {
5560
const connectionInput = document.getElementById(
5661
'connect.cloudinary_url'
5762
);
58-
const updateConnection = document.getElementById( 'update-connection' );
59-
const didSave = false;
6063

61-
updateConnection.addEventListener( 'click', () => {
64+
this.updateConnection.addEventListener( 'click', () => {
65+
this.lockNext();
6266
connectionInput.parentNode.classList.remove( 'hidden' );
63-
updateConnection.classList.add( 'hidden' );
67+
this.cancelUpdateConnection.classList.remove( 'hidden' );
68+
this.updateConnection.classList.add( 'hidden' );
69+
} );
70+
71+
this.cancelUpdateConnection.addEventListener( 'click', () => {
72+
this.unlockNext();
73+
connectionInput.parentNode.classList.add( 'hidden' );
74+
this.cancelUpdateConnection.classList.add( 'hidden' );
75+
this.updateConnection.classList.remove( 'hidden' );
76+
this.config.cldString = true;
77+
connectionInput.value = '';
78+
this.connection.error.classList.remove( 'active' );
79+
this.connection.success.classList.add( 'active' );
6480
} );
6581

6682
[ ...navs ].forEach( ( button ) => {
@@ -104,7 +120,7 @@ const Wizard = {
104120

105121
if ( this.config.cldString ) {
106122
connectionInput.parentNode.classList.add( 'hidden' );
107-
updateConnection.classList.remove( 'hidden' );
123+
this.updateConnection.classList.remove( 'hidden' );
108124
}
109125

110126
this.getTab( this.config.tab );
@@ -202,6 +218,9 @@ const Wizard = {
202218
} else {
203219
this.showSuccess();
204220
}
221+
if ( this.updateConnection.classList.contains( 'hidden' ) ) {
222+
this.lockNext();
223+
}
205224
break;
206225
case 3:
207226
if ( ! this.config.cldString ) {

ui-definitions/components/wizard.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@
142142
<input type="text" class="connection-string cld-ui-input regular-text" name="connect[cloudinary_url]" id="connect.cloudinary_url" value="" placeholder="cloudinary://API_KEY:API_SECRET@CLOUD_NAME">
143143
</div>
144144
<button id="update-connection" class="button button-primary hidden"><?php esc_html_e( 'Update the connection string', 'cloudinary' ); ?></button>
145+
<button id="cancel-update-connection" class="button button-secondary hidden"><?php esc_html_e( 'Cancel the update', 'cloudinary' ); ?></button>
145146
<span id="connection-success" class="cld-wizard-connect-status success">
146147
<span class="dashicons dashicons-yes-alt"></span> <?php esc_html_e( 'Connected!', 'cloudinary' ); ?>
147148
</span>

0 commit comments

Comments
 (0)