diff --git a/play.pokemonshowdown.com/src/client-main.ts b/play.pokemonshowdown.com/src/client-main.ts index 570eddc37..0c4965b0c 100644 --- a/play.pokemonshowdown.com/src/client-main.ts +++ b/play.pokemonshowdown.com/src/client-main.ts @@ -970,7 +970,7 @@ export class PSRoom extends PSStreamModel implements RoomOptions { * the room isn't connected to the game server but to something * else. * - * `true` for DMs for historical reasons (TODO: fix) + * 'client-only' for DMs */ connected: 'autoreconnect' | 'client-only' | 'expired' | boolean = false; /** diff --git a/play.pokemonshowdown.com/src/panel-chat.tsx b/play.pokemonshowdown.com/src/panel-chat.tsx index 17b678383..3ac73debd 100644 --- a/play.pokemonshowdown.com/src/panel-chat.tsx +++ b/play.pokemonshowdown.com/src/panel-chat.tsx @@ -68,8 +68,12 @@ export class ChatRoom extends PSRoom { } override connect() { if (!this.connected || this.connected === 'autoreconnect') { - if (this.pmTarget === null) PS.send(`/join ${this.id}`); - this.connected = true; + if (this.pmTarget === null) { + PS.send(`/join ${this.id}`); + this.connected = true; + } else { + this.connected = 'client-only'; + } this.connectWhenLoggedIn = false; } } @@ -729,7 +733,6 @@ export class ChatRoom extends PSRoom { } override destroy() { - if (this.pmTarget) this.connected = false; if (this.battle) { // since battle is defined here, we might as well deallocate it here this.battle.destroy(); @@ -1172,19 +1175,21 @@ export class ChatTextEntry extends preact.Component<{ override render() { const { room } = this.props; const OLD_TEXTBOX = false; - const canTalk = PS.user.named || room.id === 'dm-'; if (room.connected === 'client-only' && room.id.startsWith('battle-')) { return
; } + + const canTalk = PS.user.named || room.id === 'dm-'; + const connected = room.connected === true || room.connected === 'client-only'; return
{OLD_TEXTBOX ?