When the server refuses a JOIN (a bad channel name, a wrong key, an invite-only channel, a ban, a full channel), POST /api/v1/messages answers HTTP 200 with {"status": "error"} and sends the error numeric to the client's queue, as README.md documents. A successful join answers {"status": "joined", "channel": "#chan"}. Neither client checks this:
web/src/app.jsx, joinChannel, adds and shows a tab for the channel whenever the request returns, so the user gets a tab for a channel the session is not in.
internal/cli/app.go, cmdJoin, switches to the channel's buffer and makes it the target whenever JoinChannel returns no error, and SendMessage in internal/cli/api/client.go ignores the response body. What the user types next is sent to a channel the session is not in.
Found by the review of #196; read from the code on e1173eb.
Fix: both clients open, show or switch to a channel only when the join response's status is joined. On error they change nothing; the error numeric that reaches the client already tells the user why. Change nothing else in either client.
Definition of done
A refused join from the web client opens no tab and leaves the active tab as it was.
A refused join from neoirc-cli leaves its buffer and target as they were.
The error numeric still shows in both clients.
A test in internal/cli for item 2; the PR says how item 1 was checked, since the web client has no test setup.
One reviewed PR against next, cut after #196 has landed, since both change joinChannel.
Model: opus-5-5
When the server refuses a `JOIN` (a bad channel name, a wrong key, an invite-only channel, a ban, a full channel), `POST /api/v1/messages` answers HTTP 200 with `{"status": "error"}` and sends the error numeric to the client's queue, as `README.md` documents. A successful join answers `{"status": "joined", "channel": "#chan"}`. Neither client checks this:
- `web/src/app.jsx`, `joinChannel`, adds and shows a tab for the channel whenever the request returns, so the user gets a tab for a channel the session is not in.
- `internal/cli/app.go`, `cmdJoin`, switches to the channel's buffer and makes it the target whenever `JoinChannel` returns no error, and `SendMessage` in `internal/cli/api/client.go` ignores the response body. What the user types next is sent to a channel the session is not in.
Found by the review of https://git.eeqj.de/sneak/neoirc/pulls/196; read from the code on `e1173eb`.
Fix: both clients open, show or switch to a channel only when the join response's status is `joined`. On `error` they change nothing; the error numeric that reaches the client already tells the user why. Change nothing else in either client.
## Definition of done
1. A refused join from the web client opens no tab and leaves the active tab as it was.
2. A refused join from `neoirc-cli` leaves its buffer and target as they were.
3. The error numeric still shows in both clients.
4. A test in `internal/cli` for item 2; the PR says how item 1 was checked, since the web client has no test setup.
5. One reviewed PR against `next`, cut after https://git.eeqj.de/sneak/neoirc/pulls/196 has landed, since both change `joinChannel`.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
When the server refuses a
JOIN(a bad channel name, a wrong key, an invite-only channel, a ban, a full channel),POST /api/v1/messagesanswers HTTP 200 with{"status": "error"}and sends the error numeric to the client's queue, asREADME.mddocuments. A successful join answers{"status": "joined", "channel": "#chan"}. Neither client checks this:web/src/app.jsx,joinChannel, adds and shows a tab for the channel whenever the request returns, so the user gets a tab for a channel the session is not in.internal/cli/app.go,cmdJoin, switches to the channel's buffer and makes it the target wheneverJoinChannelreturns no error, andSendMessageininternal/cli/api/client.goignores the response body. What the user types next is sent to a channel the session is not in.Found by the review of #196; read from the code on
e1173eb.Fix: both clients open, show or switch to a channel only when the join response's status is
joined. Onerrorthey change nothing; the error numeric that reaches the client already tells the user why. Change nothing else in either client.Definition of done
neoirc-clileaves its buffer and target as they were.internal/clifor item 2; the PR says how item 1 was checked, since the web client has no test setup.next, cut after #196 has landed, since both changejoinChannel.Model: opus-5-5
Implemented in #198.
Model: opus-5-5