diff --git a/resources/views/components/service-disclaimer.blade.php b/resources/views/components/service-disclaimer.blade.php new file mode 100644 index 0000000..d0f695e --- /dev/null +++ b/resources/views/components/service-disclaimer.blade.php @@ -0,0 +1,23 @@ +{{-- ponytail: ein wiederverwendbarer Disclaimer für Index- und Landingpage --}} + diff --git a/resources/views/livewire/services/index.blade.php b/resources/views/livewire/services/index.blade.php index 2cdd5fd..9d5448b 100644 --- a/resources/views/livewire/services/index.blade.php +++ b/resources/views/livewire/services/index.blade.php @@ -42,6 +42,8 @@ class extends Component { }; ?>
+ +
{{ __('Self Hosted Services') }}
@@ -193,6 +195,14 @@ class extends Component {
{{ Str::length($service->createdBy->name) > 20 ? Str::substr($service->createdBy->name, 0, 4) . '...' . Str::substr($service->createdBy->name, -3) : $service->createdBy->name }} + @if($service->createdBy->nostr) + + + + + + @endif
@endif diff --git a/resources/views/livewire/services/landingpage.blade.php b/resources/views/livewire/services/landingpage.blade.php index ef03baf..f54b3e9 100644 --- a/resources/views/livewire/services/landingpage.blade.php +++ b/resources/views/livewire/services/landingpage.blade.php @@ -52,6 +52,8 @@ class extends Component { @endsection
+ +
@@ -196,6 +198,14 @@ class extends Component { {{ $service->createdBy->name }}
+ @if($service->createdBy->nostr) + + + {{ __('Ersteller auf Nostr validieren (njump)') }} + + @endif @endif
diff --git a/tests/Feature/ServiceDisclaimerTest.php b/tests/Feature/ServiceDisclaimerTest.php new file mode 100644 index 0000000..ce5408c --- /dev/null +++ b/tests/Feature/ServiceDisclaimerTest.php @@ -0,0 +1,38 @@ +for( + User::factory()->create(['nostr' => 'npub1example']), + 'createdBy' + )->create(); + + $this->get(route('services.index', ['country' => 'de'])) + ->assertOk() + ->assertSee('Keine Empfehlung von EINUNDZWANZIG') + ->assertSee('npub') + ->assertSee('https://njump.me/npub1example'); +}); + +it('shows the disclaimer and njump link on the service landingpage', function () { + $service = SelfHostedService::factory()->for( + User::factory()->create(['nostr' => 'npub1example']), + 'createdBy' + )->create(); + + $this->get(route('services.landingpage', ['country' => 'de', 'service' => $service->slug])) + ->assertOk() + ->assertSee('Keine Empfehlung von EINUNDZWANZIG') + ->assertSee('https://njump.me/npub1example'); +}); + +it('omits the njump link for anonymous services', function () { + $service = SelfHostedService::factory()->anonymous()->create(); + + $this->get(route('services.landingpage', ['country' => 'de', 'service' => $service->slug])) + ->assertOk() + ->assertSee('Keine Empfehlung von EINUNDZWANZIG') + ->assertDontSee('njump.me'); +});