diff --git a/app/Services/RideService.php b/app/Services/RideService.php index 44f4604..7c73129 100644 --- a/app/Services/RideService.php +++ b/app/Services/RideService.php @@ -244,7 +244,7 @@ class RideService 'ride_icon' => (string) ($item->icon ?? '🚘'), 'effect_title' => "{$user->username} 乘坐【{$item->name}】闪亮登场", 'effect_user_info' => $effectUserInfo, - 'identity_text' => ChatContentSanitizer::htmlText($effectUserInfo), + 'identity_text' => ChatContentSanitizer::htmlText($identitySummary['inline']), 'welcome_text' => ChatContentSanitizer::htmlText($rendered), ]; } diff --git a/tests/Feature/ChatControllerTest.php b/tests/Feature/ChatControllerTest.php index f8737ce..281e30d 100644 --- a/tests/Feature/ChatControllerTest.php +++ b/tests/Feature/ChatControllerTest.php @@ -1137,7 +1137,8 @@ class ChatControllerTest extends TestCase $this->assertSame("{$user->username} 乘坐【歼-35测试座驾】闪亮登场", $rideMessage['effect_title']); $this->assertSame("用户 {$user->username} · 部门 无部门 · 职务 无职务 · 会员 普通会员", $rideMessage['effect_user_info']); $this->assertStringContainsString($user->username, $rideMessage['content']); - $this->assertStringContainsString("用户 {$user->username} · 部门 无部门 · 职务 无职务 · 会员 普通会员", $rideMessage['content']); + $this->assertStringContainsString('部门 无部门 · 职务 无职务 · 会员 普通会员', $rideMessage['content']); + $this->assertStringNotContainsString("用户 {$user->username} · 部门 无部门", $rideMessage['content']); $this->assertSame('j35', $response->viewData('initialRideEffect')); $this->assertSame([ 'effect_title' => "{$user->username} 乘坐【歼-35测试座驾】闪亮登场", @@ -1214,7 +1215,8 @@ class ChatControllerTest extends TestCase $this->assertNotNull($rideMessage); $this->assertNull($vipPresenceMessage); - $this->assertStringContainsString("用户 {$user->username} · 部门 战备部 · 职务 🛡️ 试飞官 · 会员 👑 至尊会员", $rideMessage['content']); + $this->assertStringContainsString('部门 战备部 · 职务 🛡️ 试飞官 · 会员 👑 至尊会员', $rideMessage['content']); + $this->assertStringNotContainsString("用户 {$user->username} · 部门 战备部", $rideMessage['content']); $this->assertSame("用户 {$user->username} · 部门 战备部 · 职务 🛡️ 试飞官 · 会员 👑 至尊会员", $rideMessage['effect_user_info']); $this->assertStringContainsString($user->username, $rideMessage['content']); $this->assertSame('99a', $response->viewData('initialRideEffect'));