mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2026-06-26 02:10:24 +00:00
🔒 Fix conditional checks in Livewire Profile to prevent null errors for users without association records
- Updated Blade conditionals to verify `$currentPleb` exists before accessing its properties. - Added test case to ensure `Profile` renders correctly for logged-in pubkeys without associated pleb records.
This commit is contained in:
@@ -1191,7 +1191,7 @@ new class extends Component {
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@if($currentPubkey && $currentPleb->association_status->value < 2)
|
@if($currentPubkey && $currentPleb && $currentPleb->association_status->value < 2)
|
||||||
<flux:card class="mt-4">
|
<flux:card class="mt-4">
|
||||||
<div class="flex items-start gap-3">
|
<div class="flex items-start gap-3">
|
||||||
<svg class="shrink-0 fill-current text-green-500 mt-0.5" width="16" height="16"
|
<svg class="shrink-0 fill-current text-green-500 mt-0.5" width="16" height="16"
|
||||||
@@ -1208,7 +1208,7 @@ new class extends Component {
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if($currentPubkey && !$currentPleb->application_for && $currentPleb->association_status->value < 2)
|
@if($currentPubkey && $currentPleb && !$currentPleb->application_for && $currentPleb->association_status->value < 2)
|
||||||
<!-- Membership Registration Section -->
|
<!-- Membership Registration Section -->
|
||||||
<div class="space-y-4 py-6">
|
<div class="space-y-4 py-6">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -60,6 +60,15 @@ it('clears state on nostr logout', function () {
|
|||||||
->assertSet('currentPleb', null);
|
->assertSet('currentPleb', null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('renders without error for a logged-in pubkey that has no pleb record', function () {
|
||||||
|
NostrAuth::login(str_repeat('a', 64));
|
||||||
|
|
||||||
|
Livewire::test('association.profile')
|
||||||
|
->assertSet('currentPubkey', str_repeat('a', 64))
|
||||||
|
->assertSet('currentPleb', null)
|
||||||
|
->assertStatus(200);
|
||||||
|
});
|
||||||
|
|
||||||
it('can save email address', function () {
|
it('can save email address', function () {
|
||||||
$pleb = EinundzwanzigPleb::factory()->create();
|
$pleb = EinundzwanzigPleb::factory()->create();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user