mirror of
https://git.sr.ht/~emersion/gamja
synced 2024-12-11 00:31:26 -05:00
Clear channel joined field when disconnected
This commit is contained in:
parent
86853eb2e5
commit
25e69a551e
1 changed files with 16 additions and 1 deletions
|
@ -581,11 +581,26 @@ export default class App extends Component {
|
|||
|
||||
client.addEventListener("status", () => {
|
||||
this.setServerState(serverID, { status: client.status });
|
||||
if (client.status === Client.Status.REGISTERED) {
|
||||
switch (client.status) {
|
||||
case Client.Status.DISCONNECTED:
|
||||
this.setServerState(serverID, { account: null });
|
||||
this.setState((state) => {
|
||||
let buffers = new Map(state.buffers);
|
||||
state.buffers.forEach((buf) => {
|
||||
if (buf.server !== serverID) {
|
||||
return;
|
||||
}
|
||||
buffers.set(buf.id, { ...buf, joined: false });
|
||||
});
|
||||
return { buffers };
|
||||
});
|
||||
break;
|
||||
case Client.Status.REGISTERED:
|
||||
this.setState({ connectForm: false });
|
||||
if (errorID) {
|
||||
this.dismissError(errorID);
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue