From 07c10b3b1f551cb323124c48e2752749b31b4040 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 25 May 2021 12:40:33 +0200 Subject: [PATCH] Only switch to autojoin channel once --- components/app.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/app.js b/components/app.js index d9f147d..122939e 100644 --- a/components/app.js +++ b/components/app.js @@ -171,6 +171,7 @@ export default class App extends Component { composer = createRef(); lastNetworkID = 0; lastBufferID = 0; + switchToChannel = null; constructor(props) { super(props); @@ -507,6 +508,10 @@ export default class App extends Component { if (!this.state.activeBuffer) { this.switchBuffer({ network: netID, name: SERVER_BUFFER }); } + + if (params.autojoin.length > 0) { + this.switchToChannel = params.autojoin[0]; + } } disconnect(netID) { @@ -637,9 +642,9 @@ export default class App extends Component { if (msg.prefix.name != client.nick) { this.addMessage(netID, channel, msg); } - if (channel == this.state.connectParams.autojoin[0]) { - // TODO: only switch once right after connect + if (channel == this.switchToChannel) { this.switchBuffer({ network: netID, name: channel }); + this.switchToChannel = null; } var receipt = this.getReceipt(channel, ReceiptType.READ);