Skip to content

Commit 3a0a538

Browse files
ilicfilipclaude
andcommitted
Remove quarantine row cap; confirm large bulk operations instead
The 50-row cap was a foot-gun guard, but it cut against the goal: quarantine exists specifically so users can be brave about deleting options and recover later. Capping at 50 means a bulk delete of 80 rows partially succeeds with no UI surface for the failures — worse UX than just letting it through. Replaces the hard cap with a browser confirmation prompt when bulk deleting more than 25 selected options. The prompt names the count and reminds the user that quarantine is recoverable. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d6d8cf3 commit 3a0a538

3 files changed

Lines changed: 15 additions & 17 deletions

File tree

js/admin-script.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,19 @@ jQuery( document ).ready( function () {
779779
return;
780780
}
781781

782+
// Warn before quarantining a large batch — quarantine is recoverable
783+
// but sifting through hundreds of rows to find a culprit is painful.
784+
if ( bulkAction === 'delete' && requestData.option_names.length > 25 ) {
785+
const msg = aaaOptionOptimizer.i18n.confirmBulkQuarantine.replace(
786+
'%d',
787+
requestData.option_names.length
788+
);
789+
// eslint-disable-next-line no-alert
790+
if ( ! window.confirm( msg ) ) {
791+
return;
792+
}
793+
}
794+
782795
const endpoint =
783796
'delete' === bulkAction
784797
? 'delete-options'

src/class-admin-page.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ public function enqueue_scripts( $hook ) {
240240
'restore' => \esc_html__( 'Restore', 'aaa-option-optimizer' ),
241241
'permanentlyDelete' => \esc_html__( 'Permanently delete', 'aaa-option-optimizer' ),
242242
'confirmPermanentDelete' => \esc_html__( 'Permanently delete this option? This cannot be undone.', 'aaa-option-optimizer' ),
243+
/* translators: %d: number of selected options */
244+
'confirmBulkQuarantine' => \esc_html__( 'You are about to quarantine %d options. They can be restored from the Quarantine tab. Continue?', 'aaa-option-optimizer' ),
243245
'importSelectFile' => \esc_html__( 'Select JSON file', 'aaa-option-optimizer' ),
244246
'importOverwriteLabel' => \esc_html__( 'Overwrite existing options', 'aaa-option-optimizer' ),
245247
'importButton' => \esc_html__( 'Import', 'aaa-option-optimizer' ),

src/class-quarantine.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ class Quarantine {
1717
*/
1818
const CRON_HOOK = 'aaa_option_optimizer_quarantine_cleanup';
1919

20-
/**
21-
* Hard cap on simultaneously quarantined options.
22-
*/
23-
const MAX_ROWS = 50;
24-
2520
/**
2621
* Default retention in days.
2722
*/
@@ -68,18 +63,6 @@ public function quarantine( $option_name ) {
6863
);
6964
}
7065

71-
if ( Database::count_quarantine_rows() >= self::MAX_ROWS ) {
72-
return new \WP_Error(
73-
'quarantine_full',
74-
\sprintf(
75-
/* translators: %d: max quarantine rows */
76-
\__( 'Quarantine is full (max %d options). Restore or permanently delete some entries first.', 'aaa-option-optimizer' ),
77-
self::MAX_ROWS
78-
),
79-
[ 'status' => 409 ]
80-
);
81-
}
82-
8366
global $wpdb;
8467

8568
// Read the live row directly so we capture the raw stored value and autoload flag.

0 commit comments

Comments
 (0)