Add leader management functionality for Meetups

-  Introduced `leaders`, `promoteLeader`, and `demoteLeader` methods in `Meetup` model for consistent handling of meetup leadership.
- ⚙️ Refactored `MeetupLeaderController` to use new leadership methods, improving reusability and maintainability.
- 👮‍♂️ Added `ValidNpub` validation rule for npub input standardization.
- 🧪 Added feature tests for leadership delegation and permissions.
- 🖼️ Implemented leader management UI in meetup edit page with flash messaging for actions.
This commit is contained in:
HolgerHatGarKeineNode
2026-06-16 23:11:24 +02:00
parent 9f8fda294a
commit ffcee850ca
6 changed files with 289 additions and 27 deletions
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
use swentel\nostr\Key\Key as NostrKey;
/**
* Validiert einen Nostr-npub (bech32-kodierter öffentlicher Schlüssel).
* Geteilt von der REST-API (StoreMeetupLeaderRequest) und der Leader-
* Verwaltung im Portal-Frontend, damit beide Wege dieselbe Prüfung nutzen.
*/
class ValidNpub implements ValidationRule
{
public function validate(string $attribute, mixed $value, Closure $fail): void
{
if (! is_string($value) || ! str_starts_with($value, 'npub1')) {
$fail(__('Das ist kein gültiger npub.'));
return;
}
try {
(new NostrKey)->convertToHex($value);
} catch (\Throwable) {
$fail(__('Das ist kein gültiger npub.'));
}
}
}