增加 神秘箱子的屏蔽

This commit is contained in:
2026-04-17 15:27:40 +08:00
parent 0f4de941db
commit 0e8a1669b9
4 changed files with 30 additions and 5 deletions
@@ -146,6 +146,12 @@ $welcomeMessages = [
onchange="toggleBlockedSystemSender('跑马', this.checked)">
跑马
</label>
<label
style="display:flex;align-items:center;gap:6px;font-size:12px;color:#1e293b;cursor:pointer;padding:4px 2px;">
<input type="checkbox" id="block-sender-mystery-box"
onchange="toggleBlockedSystemSender('神秘箱子', this.checked)">
神秘箱子
</label>
</div>
</div>
@@ -39,7 +39,7 @@
const onlineCountBottom = document.getElementById('online-count-bottom');
const BLOCKED_SYSTEM_SENDERS_STORAGE_KEY = 'chat_blocked_system_senders';
const CHAT_SOUND_MUTED_STORAGE_KEY = 'chat_sound_muted';
const BLOCKABLE_SYSTEM_SENDERS = ['钓鱼播报', '星海小博士', '百家乐', '跑马','神秘箱子'];
const BLOCKABLE_SYSTEM_SENDERS = ['钓鱼播报', '星海小博士', '百家乐', '跑马', '神秘箱子'];
// ── 消息区:手机端双触发打开用户名片(PC 端靠 ondblclick 内联属性)──
// span[data-u] 由 clickableUser() 生成,touchend 委托至容器避免每条消息单独绑定
@@ -200,6 +200,7 @@
const doctorCheckbox = document.getElementById('block-sender-doctor');
const baccaratCheckbox = document.getElementById('block-sender-baccarat');
const horseRaceCheckbox = document.getElementById('block-sender-horse-race');
const mysteryBoxCheckbox = document.getElementById('block-sender-mystery-box');
if (fishingCheckbox) {
fishingCheckbox.checked = blockedSystemSenders.has('钓鱼播报');
@@ -216,6 +217,10 @@
if (horseRaceCheckbox) {
horseRaceCheckbox.checked = blockedSystemSenders.has('跑马');
}
if (mysteryBoxCheckbox) {
mysteryBoxCheckbox.checked = blockedSystemSenders.has('神秘箱子');
}
}
/**
@@ -232,10 +237,18 @@
return '钓鱼播报';
}
if (fromUser === '神秘箱子') {
return '神秘箱子';
}
if (fromUser === '星海小博士') {
return '星海小博士';
}
if ((fromUser === '系统传音' || fromUser === '系统') && content.includes('神秘箱子')) {
return '神秘箱子';
}
if ((fromUser === '系统传音' || fromUser === '系统') && content.includes('百家乐')) {
return '百家乐';
}
@@ -952,7 +965,7 @@
let timeStrOverride = false;
// 系统用户名列表(不可被选为聊天对象)
const systemUsers = ['钓鱼播报', '星海小博士', '系统传音', '系统公告', '送花播报', '系统', '欢迎', '系统播报'];
const systemUsers = ['钓鱼播报', '星海小博士', '系统传音', '系统公告', '送花播报', '系统', '欢迎', '系统播报', '神秘箱子'];
// 动作文字映射表:情绪型(着/地,放"对"之前)和动作型(了,替换"对X说"
const actionTextMap = {
+1
View File
@@ -77,6 +77,7 @@ class ChatControllerTest extends TestCase
$response->assertSee('星海小博士');
$response->assertSee('百家乐');
$response->assertSee('跑马');
$response->assertSee('神秘箱子');
$response->assertSee('chat_blocked_system_senders');
$response->assertSee('toggleBlockedSystemSender');
}
+8 -3
View File
@@ -16,6 +16,10 @@ use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Redis;
use Tests\TestCase;
/**
* 用户控制器功能测试
* 覆盖个人资料、密码与聊天室偏好设置等关键接口。
*/
class UserControllerTest extends TestCase
{
use RefreshDatabase;
@@ -141,19 +145,20 @@ class UserControllerTest extends TestCase
]);
$response = $this->actingAs($user)->putJson('/user/chat-preferences', [
'blocked_system_senders' => ['钓鱼播报', '跑马'],
'blocked_system_senders' => ['钓鱼播报', '神秘箱子', '跑马'],
'sound_muted' => true,
]);
$response->assertOk()
->assertJsonPath('status', 'success')
->assertJsonPath('data.blocked_system_senders.0', '钓鱼播报')
->assertJsonPath('data.blocked_system_senders.1', '跑马')
->assertJsonPath('data.blocked_system_senders.1', '神秘箱子')
->assertJsonPath('data.blocked_system_senders.2', '跑马')
->assertJsonPath('data.sound_muted', true);
$user->refresh();
$this->assertEquals([
'blocked_system_senders' => ['钓鱼播报', '跑马'],
'blocked_system_senders' => ['钓鱼播报', '神秘箱子', '跑马'],
'sound_muted' => true,
], $user->chat_preferences);
}