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:
Simon Ser 2021-11-05 11:49:56 +01:00
parent 7b19cf48a4
commit 800f5ceb6a
3 changed files with 44 additions and 13 deletions

View file

@ -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) {