重构猜谜活动并统一聊天室答题通知

This commit is contained in:
pllx
2026-04-29 13:35:20 +08:00
parent 192259f0a4
commit fe3e74b5f8
34 changed files with 3369 additions and 1833 deletions
+27
View File
@@ -444,6 +444,33 @@ class UserControllerTest extends TestCase
], $user->chat_preferences);
}
/**
* 测试猜谜活动新文案会兼容落回旧的屏蔽键。
*/
public function test_quiz_activity_block_preference_is_normalized_to_legacy_sender_key(): void
{
$user = User::factory()->create([
'chat_preferences' => null,
]);
$response = $this->actingAs($user)->putJson('/user/chat-preferences', [
'blocked_system_senders' => ['猜谜活动', '钓鱼播报'],
'sound_muted' => false,
]);
$response->assertOk()
->assertJsonPath('status', 'success')
->assertJsonPath('data.blocked_system_senders.0', '猜成语')
->assertJsonPath('data.blocked_system_senders.1', '钓鱼播报')
->assertJsonPath('data.sound_muted', false);
$user->refresh();
$this->assertEquals([
'blocked_system_senders' => ['猜成语', '钓鱼播报'],
'sound_muted' => false,
], $user->chat_preferences);
}
/**
* 测试合法聊天室当日状态可以保存,并在当天结束后自动失效。
*/