Keep track of channel join status
This makes us behave better when we receive a self-PART message from the server.
This commit is contained in:
+14
-4
@@ -1023,7 +1023,9 @@ export default class App extends Component {
|
||||
}
|
||||
break;
|
||||
case BufferType.CHANNEL:
|
||||
client.send({ command: "PART", params: [buf.name] });
|
||||
if (buf.joined) {
|
||||
client.send({ command: "PART", params: [buf.name] });
|
||||
}
|
||||
// fallthrough
|
||||
case BufferType.NICK:
|
||||
this.switchBuffer({ name: SERVER_BUFFER });
|
||||
@@ -1150,8 +1152,16 @@ export default class App extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
handleJoinClick(serverID) {
|
||||
this.openDialog("join", { server: serverID });
|
||||
handleJoinClick(buf) {
|
||||
switch (buf.type) {
|
||||
case BufferType.SERVER:
|
||||
this.openDialog("join", { server: buf.server });
|
||||
break;
|
||||
case BufferType.CHANNEL:
|
||||
let client = this.clients.get(buf.server);
|
||||
client.send({ command: "JOIN", params: [buf.name] });
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
handleJoinSubmit(data) {
|
||||
@@ -1351,7 +1361,7 @@ export default class App extends Component {
|
||||
bouncerNetwork=${activeBouncerNetwork}
|
||||
onChannelClick=${this.handleChannelClick}
|
||||
onClose=${() => this.close(activeBuffer)}
|
||||
onJoin=${() => this.handleJoinClick(activeBuffer.server)}
|
||||
onJoin=${() => this.handleJoinClick(activeBuffer)}
|
||||
onAddNetwork=${this.handleAddNetworkClick}
|
||||
onManageNetwork=${() => this.handleManageNetworkClick(activeBuffer.server)}
|
||||
/>
|
||||
|
||||
@@ -117,13 +117,27 @@ export default function BufferHeader(props) {
|
||||
if (props.buffer.topic) {
|
||||
description = linkify(stripANSI(props.buffer.topic), props.onChannelClick);
|
||||
}
|
||||
actions = html`
|
||||
<button
|
||||
key="part"
|
||||
class="danger"
|
||||
onClick=${handleCloseClick}
|
||||
>Leave</button>
|
||||
`;
|
||||
if (props.buffer.joined) {
|
||||
actions = html`
|
||||
<button
|
||||
key="part"
|
||||
class="danger"
|
||||
onClick=${handleCloseClick}
|
||||
>Leave</button>
|
||||
`;
|
||||
} else {
|
||||
actions = html`
|
||||
<button
|
||||
key="join"
|
||||
onClick=${handleJoinClick}
|
||||
>Join</button>
|
||||
<button
|
||||
key="part"
|
||||
class="danger"
|
||||
onClick=${handleCloseClick}
|
||||
>Close</button>
|
||||
`;
|
||||
}
|
||||
break;
|
||||
case BufferType.NICK:
|
||||
if (props.user) {
|
||||
|
||||
Reference in New Issue
Block a user