From ff676333f39682c5a98af61aece85070bfb501e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Mon, 16 Mar 2026 11:05:00 +0800 Subject: [PATCH] refactor(site-subscriptions): dedupe show page back actions --- resources/views/admin/site_subscriptions/show.blade.php | 3 ++- ...AdminSiteSubscriptionShowIndexLinkKeepsContextTest.php | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/resources/views/admin/site_subscriptions/show.blade.php b/resources/views/admin/site_subscriptions/show.blade.php index 59f75a4..f7ae22a 100644 --- a/resources/views/admin/site_subscriptions/show.blade.php +++ b/resources/views/admin/site_subscriptions/show.blade.php @@ -50,8 +50,9 @@
@if($safeBackForLinks !== '') 返回上一页(保留上下文) + @else + 返回订阅列表(保留上下文) @endif - 返回订阅列表(保留上下文)
diff --git a/tests/Feature/AdminSiteSubscriptionShowIndexLinkKeepsContextTest.php b/tests/Feature/AdminSiteSubscriptionShowIndexLinkKeepsContextTest.php index 656c551..24f75e3 100644 --- a/tests/Feature/AdminSiteSubscriptionShowIndexLinkKeepsContextTest.php +++ b/tests/Feature/AdminSiteSubscriptionShowIndexLinkKeepsContextTest.php @@ -66,5 +66,13 @@ class AdminSiteSubscriptionShowIndexLinkKeepsContextTest extends TestCase $res->assertSee('返回订阅列表(保留上下文)'); $res->assertSee($expectedIndexUrl, false); + + // 当传入有效 back 时,应优先显示“返回上一页”并隐藏该兜底按钮(避免重复入口噪音) + $res2 = $this->get('/admin/site-subscriptions/' . $sub->id . '?' . Arr::query([ + 'back' => '/admin', + ])); + $res2->assertOk(); + $res2->assertSee('返回上一页(保留上下文)'); + $res2->assertDontSee('返回订阅列表(保留上下文)'); } }