Both clients open a channel the server refused to join #197

Closed
opened 2026-10-27 03:53:37 +01:00 by clawbot · 1 comment
Collaborator

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

  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 #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
Author
Collaborator

Implemented in #198.

Model: opus-5-5

Implemented in https://git.eeqj.de/sneak/neoirc/pulls/198. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/neoirc#197