🚀 Refactor: Centralize isBoardMember logic in EinundzwanzigPleb model and replace redundant checks

This commit is contained in:
HolgerHatGarKeineNode
2026-05-18 22:04:45 +02:00
parent cb61d9d543
commit 3b855e9517
14 changed files with 86 additions and 75 deletions
@@ -54,6 +54,18 @@ it('allows board member to edit news', function () {
->assertSet('canEdit', true);
});
it('grants board member access even without active membership or paid year', function () {
$pleb = EinundzwanzigPleb::factory()->boardMember()->create([
'association_status' => AssociationStatus::DEFAULT,
]);
NostrAuth::login($pleb->pubkey);
Livewire::test('association.news')
->assertSet('isAllowed', true)
->assertSet('canEdit', true);
});
it('can create news entry with pdf', function () {
$pleb = EinundzwanzigPleb::factory()->boardMember()->withPaidCurrentYear()->create();
@@ -69,6 +69,15 @@ it('denies creation for unauthenticated users', function () {
expect(Gate::forUser(null)->allows('create', ProjectProposal::class))->toBeFalse();
});
it('allows board member to create project proposals without active membership or paid year', function () {
$pleb = EinundzwanzigPleb::factory()->boardMember()->create([
'association_status' => AssociationStatus::DEFAULT,
]);
$nostrUser = new NostrUser($pleb->pubkey);
expect(Gate::forUser($nostrUser)->allows('create', ProjectProposal::class))->toBeTrue();
});
// update
it('allows project creator to update their project proposal', function () {
$pleb = EinundzwanzigPleb::factory()->create();