Bump plugin version so the us_invites schema migration actually runs
CI / Tests (PHP 8.2) (pull_request) Successful in 37s
CI / Tests (PHP 8.1) (pull_request) Successful in 44s
CI / No Debug Code (pull_request) Successful in 2s
CI / Coding Standards (pull_request) Successful in 2m55s
CI / PHPStan (pull_request) Successful in 2m54s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m36s
CI / Build Plugin Zip (pull_request) Skipped

PR #83 added kind and expires_at to us_invites and the repository started
writing them, but USC_VERSION stayed at 1.0.0-rc.2 — Plugin::boot() only
re-runs Installer/dbDelta on a version mismatch, so upgraded sites never got
the columns. Every invite insert then failed silently: nothing appeared under
Pending Invites while the admin was still shown a registration link whose
token hash was never stored.

- Version / USC_VERSION -> 1.0.0-rc.3 (triggers dbDelta on next load).
- InviteRepository::insert() returns 0 on failure instead of a stale
  insert_id, and the Invites page now shows an error notice instead of a
  dead link when creation fails (personal and group forms), including
  clearer validation messages.
- CLAUDE.md: schema changes must bump the version.

Closes #87

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
2026-07-22 11:37:14 -03:00
co-authored by Claude Fable 5
parent c9eaa6f3bc
commit 0d9aafbb5b
6 changed files with 83 additions and 38 deletions
+10
View File
@@ -46,6 +46,16 @@ class InviteRepositoryTest extends TestCase
self::assertSame(5, $this->repo->insert(new Invite('[email protected]', 'tok123', invitedBy: 2)));
}
public function testInsertReturnsZeroWhenDbInsertFails(): void
{
Functions\expect('current_time')->with('mysql')->andReturn('2026-06-02 09:00:00');
$this->db->shouldReceive('insert')->once()->andReturn(false);
$this->db->insert_id = 99; // Stale id from an earlier insert must not leak out.
self::assertSame(0, $this->repo->insert(new Invite('[email protected]', 'tok123')));
}
public function testInsertPersistsGroupKindAndExpiry(): void
{
Functions\expect('current_time')->with('mysql')->andReturn('2026-06-02 09:00:00');