Fix reboot notice scope and preserve raw slash command input
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// Maintainer-controlled web client version.
|
// Maintainer-controlled web client version.
|
||||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
||||||
window.CHGRID_WEB_VERSION = "2026.02.27 R297";
|
window.CHGRID_WEB_VERSION = "2026.02.27 R298";
|
||||||
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
||||||
window.CHGRID_TIME_ZONE = "America/Detroit";
|
window.CHGRID_TIME_ZONE = "America/Detroit";
|
||||||
|
|||||||
@@ -2368,13 +2368,15 @@ function handleHelpViewModeInput(code: string): void {
|
|||||||
function handleChatModeInput(code: string, key: string, ctrlKey: boolean): void {
|
function handleChatModeInput(code: string, key: string, ctrlKey: boolean): void {
|
||||||
const editAction = getEditSessionAction(code);
|
const editAction = getEditSessionAction(code);
|
||||||
if (editAction === 'submit') {
|
if (editAction === 'submit') {
|
||||||
const message = state.nicknameInput.trim();
|
const rawMessage = state.nicknameInput;
|
||||||
if (message.length > 0) {
|
if (rawMessage.trim().length > 0) {
|
||||||
signaling.send({ type: 'chat_message', message });
|
signaling.send({ type: 'chat_message', message: rawMessage });
|
||||||
state.mode = 'normal';
|
state.mode = 'normal';
|
||||||
state.nicknameInput = '';
|
state.nicknameInput = '';
|
||||||
state.cursorPos = 0;
|
state.cursorPos = 0;
|
||||||
audio.sfxUiConfirm();
|
if (!/^\/me(?:\s|$)/i.test(rawMessage)) {
|
||||||
|
audio.sfxUiConfirm();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
state.mode = 'normal';
|
state.mode = 'normal';
|
||||||
audio.sfxUiCancel();
|
audio.sfxUiCancel();
|
||||||
|
|||||||
@@ -1686,7 +1686,8 @@ class SignalingServer:
|
|||||||
return True
|
return True
|
||||||
reboot_message = remainder if separator else ""
|
reboot_message = remainder if separator else ""
|
||||||
if not self._schedule_reboot(client.username or client.nickname, reboot_message):
|
if not self._schedule_reboot(client.username or client.nickname, reboot_message):
|
||||||
await self._broadcast(
|
await self._send(
|
||||||
|
client.websocket,
|
||||||
BroadcastChatMessagePacket(
|
BroadcastChatMessagePacket(
|
||||||
type="chat_message",
|
type="chat_message",
|
||||||
message="Server reboot already in progress.",
|
message="Server reboot already in progress.",
|
||||||
|
|||||||
@@ -586,7 +586,7 @@ async def test_chat_reboot_schedules_and_broadcasts_message(monkeypatch: pytest.
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_chat_reboot_already_in_progress_broadcasts_notice(monkeypatch: pytest.MonkeyPatch) -> None:
|
async def test_chat_reboot_already_in_progress_sends_sender_only_notice(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
server = SignalingServer("127.0.0.1", 8765, None, None)
|
server = SignalingServer("127.0.0.1", 8765, None, None)
|
||||||
ws = _fake_ws()
|
ws = _fake_ws()
|
||||||
client = ClientConnection(
|
client = ClientConnection(
|
||||||
@@ -615,9 +615,9 @@ async def test_chat_reboot_already_in_progress_broadcasts_notice(monkeypatch: py
|
|||||||
|
|
||||||
await server._handle_message(client, json.dumps({"type": "chat_message", "message": "/reboot maintenance"}))
|
await server._handle_message(client, json.dumps({"type": "chat_message", "message": "/reboot maintenance"}))
|
||||||
|
|
||||||
assert send_payloads == []
|
assert broadcast_payloads == []
|
||||||
assert len(broadcast_payloads) == 1
|
assert len(send_payloads) == 1
|
||||||
packet = broadcast_payloads[0]
|
packet = send_payloads[0]
|
||||||
assert getattr(packet, "type", "") == "chat_message"
|
assert getattr(packet, "type", "") == "chat_message"
|
||||||
assert packet.system is True
|
assert packet.system is True
|
||||||
assert packet.message == "Server reboot already in progress."
|
assert packet.message == "Server reboot already in progress."
|
||||||
|
|||||||
Reference in New Issue
Block a user