Demo follow-ups: editable policy name, one-page signup, group classes in upcoming lessons, deletion cleanup
CI / Tests (PHP 8.1) (pull_request) Successful in 1m0s
CI / Tests (PHP 8.2) (pull_request) Successful in 1m0s
CI / No Debug Code (pull_request) Successful in 3s
CI / Coding Standards (pull_request) Successful in 3m8s
CI / Build Plugin Zip (pull_request) Skipped
CI / PHPStan (pull_request) Successful in 2m49s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m44s

Five items from the latest demo pass:

- A policy's title can be edited from the Policies screen. Only the title
  moves; the slug is what the gates resolve policies by, so a rename can
  never detach a policy from acceptances already recorded against it.
- Signup is one page again. The studio's registration questions move from
  a second step behind "Next" onto the main form, in an "About you" panel
  above the students being added, and that panel also asks an adult
  student for their birth year (the same us_birth_year meta a child's
  uses). register.js disables and hides the whole panel for a pure
  guardian, since the questions describe a student.
- The password is re-scored on submit, not only as it is typed. zxcvbn's
  dictionary arrives after page load, so a password typed straight away
  was never scored at all and the first the student heard of it was the
  server rejecting the whole form.
- Group-class sessions appear alongside lessons wherever upcoming lessons
  are listed: the [us_scheduler] panel (students and instructors) and the
  admin student detail page. GroupClass\SessionSchedule derives them from
  Offering::sessionWindows(), the same derivation the billing scan uses.
  They carry kind = 'group_class' and no Cancel action - a session is one
  date in a term, not a booked slot.
- Deleting a user releases what the account was holding: each upcoming
  lesson is cancelled, its slot freed for rebooking, its pending payment
  voided, and active class enrolments cancelled. Past lessons and paid
  history are left alone.

Tests: composer test (851), composer lint, composer cs all pass.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
2026-07-30 11:45:04 -03:00
co-authored by Claude Opus 5
parent 258468093b
commit cb347ffca0
33 changed files with 1419 additions and 291 deletions
+19
View File
@@ -76,6 +76,25 @@ class PolicyController {
return [ '', 0 ];
}
if ( 'rename_policy' === $action ) {
$title = trim( sanitize_text_field( Val::string( wp_unslash( $_POST['title'] ?? '' ) ) ) );
if ( '' === $title || mb_strlen( $title ) > Policy::MAX_TITLE_LENGTH ) {
return [ '', 0 ];
}
$this->policies->updateTitle( $policyId, $title );
return [
sprintf(
/* translators: %s: the policy's new title. */
__( 'Policy renamed to "%s".', 'unsupervised-schedular' ),
$title
),
0,
];
}
if ( 'add_version' === $action ) {
$body = wp_kses_post( Val::string( wp_unslash( $_POST['body'] ?? '' ) ) );
$this->service->addDraftVersion( $policyId, $body );
+16
View File
@@ -46,6 +46,22 @@ class PolicyRepository {
return array_map( Policy::fromRow( ... ), $rows ?? [] );
}
/**
* Rename a policy. Only the title moves: the slug is the identifier the
* booking and signup gates look policies up by, so renaming "Studio Policy"
* to "Terms of Enrolment" must not quietly detach it from the versions
* students have already accepted.
*/
public function updateTitle( int $policyId, string $title ): bool {
return false !== $this->db->update(
$this->table,
[ 'title' => $title ],
[ 'id' => $policyId ],
[ '%s' ],
[ '%d' ]
);
}
public function updateCurrentVersion( int $policyId, int $versionId ): bool {
return false !== $this->db->update(
$this->table,