Surface destination edits as the core dynamic short-link feature.
Deploy Ladill Link / deploy (push) Successful in 1m40s

Move destination editing to the top of the link page, clarify that the short URL never changes, prevent caches from pinning old redirects, and test that later destination updates take effect immediately.
This commit is contained in:
isaacclad
2026-07-16 20:12:14 +00:00
parent d45f4b5c58
commit 86cac606e0
5 changed files with 105 additions and 42 deletions
+33
View File
@@ -92,6 +92,39 @@ class LinkRedirectTest extends TestCase
$this->assertSame('go.example.test', ShortLink::publicHost());
}
public function test_changing_destination_later_redirects_to_new_url(): void
{
$user = $this->user();
$link = ShortLink::create([
'user_id' => $user->id,
'slug' => 'campaign',
'source_app' => 'link',
'source_kind' => 'redirect',
'is_managed_here' => true,
'destination_url' => 'https://example.com/old-landing',
'is_active' => true,
]);
$this->get('https://ladl.link/campaign')
->assertRedirect('https://example.com/old-landing');
// Destination edit is a first-class Link feature (not frozen at create time).
app(\App\Services\Link\LinkManagerService::class)->update($link, [
'destination_url' => 'https://example.com/new-landing',
'label' => 'Spring campaign',
]);
$link->refresh();
$this->assertSame('https://example.com/new-landing', $link->destination_url);
// Short slug stays put — only the destination changes.
$this->assertSame('campaign', $link->slug);
$this->assertSame('https://ladl.link/campaign', $link->publicUrl());
$response = $this->get('https://ladl.link/campaign');
$response->assertRedirect('https://example.com/new-landing');
$this->assertStringContainsString('no-store', (string) $response->headers->get('Cache-Control'));
}
public function test_catalog_qr_links_proxy_to_platform_instead_of_bad_destination(): void
{
$user = $this->user();