Nimm die Rueckkehr aus dem Modul auch bei einer vollstaendigen Adresse an.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
a7feef2cd2
commit
42415dff51
3 files changed
+12
-5
No files matched your search
@@ -186,7 +186,7 @@ public function isProgram(): bool
|
|||||||
|
|
||||||
public function selfUrl(): string
|
public function selfUrl(): string
|
||||||
{
|
{
|
||||||
return static::getResource()::getUrl('edit', ['record' => $this->getRecord()]);
|
return $this->safeReturn(static::getResource()::getUrl('edit', ['record' => $this->getRecord()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function previewUrl(): ?string
|
public function previewUrl(): ?string
|
||||||
@@ -887,17 +887,18 @@ protected function actor(): ?User
|
|||||||
|
|
||||||
protected function safeReturn(mixed $url): string
|
protected function safeReturn(mixed $url): string
|
||||||
{
|
{
|
||||||
if (! is_string($url) || $url === '' || parse_url($url, PHP_URL_HOST)) {
|
if (! is_string($url) || $url === '') {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = parse_url($url, PHP_URL_PATH);
|
$parts = parse_url($url);
|
||||||
|
$path = is_array($parts) ? ($parts['path'] ?? '') : '';
|
||||||
|
|
||||||
if (! is_string($path) || ! str_starts_with($path, '/verwaltung/') || str_contains($path, '..')) {
|
if (! is_string($path) || ! str_starts_with($path, '/verwaltung/') || str_contains($path, '..')) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = parse_url($url, PHP_URL_QUERY);
|
$query = is_array($parts) ? ($parts['query'] ?? '') : '';
|
||||||
|
|
||||||
return $path.(is_string($query) && $query !== '' ? '?'.$query : '');
|
return $path.(is_string($query) && $query !== '' ? '?'.$query : '');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<ol class="luf-list">
|
<ol class="luf-list">
|
||||||
@foreach ($this->members as $index => $member)
|
@foreach ($this->members as $index => $member)
|
||||||
<li class="luf-part-row" wire:key="teil-{{ $member['target'] }}-{{ $index }}">
|
<li class="luf-part-row" wire:key="teil-{{ $member['target'] }}-{{ $index }}">
|
||||||
<button type="button" class="luf-part" wire:click="selectPart({{ $index }})" aria-current="{{ $this->selected === $index ? 'true' : 'false' }}">
|
<button type="button" class="luf-part" wire:click="selectPart({{ $index }})" @if ($this->selected === $index) aria-current="true" @endif>
|
||||||
<span class="luf-pos">{{ $index + 1 }}</span>
|
<span class="luf-pos">{{ $index + 1 }}</span>
|
||||||
<span>
|
<span>
|
||||||
<span class="luf-kind">{{ $member['role'] }}</span>
|
<span class="luf-kind">{{ $member['role'] }}</span>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
use App\Filament\Pages\EditorialDesk;
|
use App\Filament\Pages\EditorialDesk;
|
||||||
use App\Filament\Resources\Courses\CourseResource;
|
use App\Filament\Resources\Courses\CourseResource;
|
||||||
use App\Filament\Resources\Courses\Pages\EditCourse;
|
use App\Filament\Resources\Courses\Pages\EditCourse;
|
||||||
|
use App\Filament\Resources\Exercises\ExerciseResource;
|
||||||
use App\Filament\Resources\Exercises\Pages\EditExercise;
|
use App\Filament\Resources\Exercises\Pages\EditExercise;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
@@ -171,6 +172,11 @@ public function test_a_new_module_returns_into_the_program(): void
|
|||||||
|
|
||||||
$this->assertSame(CompositionKind::Uebung, $module->kind);
|
$this->assertSame(CompositionKind::Uebung, $module->kind);
|
||||||
|
|
||||||
|
$this->actingAs($editor, 'staff')
|
||||||
|
->get(ExerciseResource::getUrl('edit', ['record' => $module]).'?zurueck='.urlencode('http://example.test/verwaltung/kurse/1'))
|
||||||
|
->assertOk()
|
||||||
|
->assertSee('Zurück und einbinden');
|
||||||
|
|
||||||
Livewire::actingAs($editor, 'staff')
|
Livewire::actingAs($editor, 'staff')
|
||||||
->test(EditExercise::class, ['record' => $module->id])
|
->test(EditExercise::class, ['record' => $module->id])
|
||||||
->set('returnUrl', $programUrl)
|
->set('returnUrl', $programUrl)
|
||||||
|
|||||||
Reference in new issue
Block a user