Bulk delete availability slots from the admin list view #58

Merged
thatguygriff merged 1 commits from feature/availability-bulk-delete into main 2026-07-06 01:32:32 +00:00
Owner

Closes #57

What

Adds multi-select removal of availability slots to the My Availability list view:

  • Checkbox per slot row — rendered only for unbooked slots (booked slots remain undeletable)
  • Select-all checkbox in the table header (handled by WP core's admin JS)
  • Delete selected button with a confirmation prompt, submitting a new bulk_delete form action behind the existing usc_availability_action nonce

How

  • AvailabilityController: new bulk_delete branch; single and bulk delete now share a deleteOwnSlot() helper that ownership-checks each id. AvailabilityRepository::delete()'s existing is_booked = 0 guard refuses booked slots as a second layer even for forged ids.
  • templates/admin/availability.php: the row checkboxes attach to a separate bulk form via the HTML form attribute, since the table already contains the per-row delete forms and forms cannot nest.
  • New tests/Unit/Availability/AvailabilityControllerTest.php: bulk delete removes only owned existing slots (skips other instructors' slots, junk ids, missing ids), non-array slot_ids is ignored, single delete still enforces ownership, checkboxes render only for unbooked slots.
  • Feature doc updated.

Testing

composer test (290 tests), composer lint (PHPStan level 10), and composer cs all pass.

🤖 Generated with Claude Code

Closes #57 ## What Adds multi-select removal of availability slots to the **My Availability** list view: - Checkbox per slot row — rendered only for unbooked slots (booked slots remain undeletable) - Select-all checkbox in the table header (handled by WP core's admin JS) - **Delete selected** button with a confirmation prompt, submitting a new `bulk_delete` form action behind the existing `usc_availability_action` nonce ## How - `AvailabilityController`: new `bulk_delete` branch; single and bulk delete now share a `deleteOwnSlot()` helper that ownership-checks each id. `AvailabilityRepository::delete()`'s existing `is_booked = 0` guard refuses booked slots as a second layer even for forged ids. - `templates/admin/availability.php`: the row checkboxes attach to a separate bulk form via the HTML `form` attribute, since the table already contains the per-row delete forms and forms cannot nest. - New `tests/Unit/Availability/AvailabilityControllerTest.php`: bulk delete removes only owned existing slots (skips other instructors' slots, junk ids, missing ids), non-array `slot_ids` is ignored, single delete still enforces ownership, checkboxes render only for unbooked slots. - Feature doc updated. ## Testing `composer test` (290 tests), `composer lint` (PHPStan level 10), and `composer cs` all pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
thatguygriff added 1 commit 2026-07-06 01:25:55 +00:00
Bulk delete availability slots from the admin list view
CI / No Debug Code (pull_request) Successful in 2s
CI / Coding Standards (pull_request) Successful in 1m40s
CI / Tests (PHP 8.1) (pull_request) Successful in 46s
CI / Tests (PHP 8.2) (pull_request) Successful in 45s
CI / Tests (PHP 8.3) (pull_request) Successful in 1m34s
CI / PHPStan (pull_request) Successful in 2m52s
CI / Build Plugin Zip (pull_request) Has been skipped
c743ed5459
The list view of Current Slots gets a checkbox per unbooked slot, a
select-all header checkbox, and a Delete selected button submitting a
new bulk_delete form action. Each id is ownership-checked through the
same path as single delete; the repository's is_booked guard refuses
booked slots as a second layer. Row checkboxes attach to the bulk form
via the HTML form attribute because the table already contains the
per-row delete forms and forms cannot nest.

Closes #57

Co-Authored-By: Claude Fable 5 <[email protected]>
thatguygriff merged commit 9d8924132c into main 2026-07-06 01:32:32 +00:00
thatguygriff deleted branch feature/availability-bulk-delete 2026-07-06 01:32:32 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Unsupervised/unsupervised-scheduler#58