fix(web/classic): use POST /api/channel/:id/status for enable/disable - #5894
fix(web/classic): use POST /api/channel/:id/status for enable/disable#5894leewaiho wants to merge 1 commit into
Conversation
PR QuantumNous#5755 (4aee5f7) rejected `status` in PUT /api/channel/ and migrated the default theme to POST /api/channel/:id/status, but classic's manageChannel was left on PUT + body{status}, breaking enable/disable under classic theme on rc.16+ (backend returns "无效的参数"). Switch enable/disable to the same POST endpoint; derive record.status from the target value because POST returns {data: changed bool}, not a channel object. priority/weight/enable_all keep PUT (their body has no `status` field, so they don't trip the interceptor).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe ChangesChannel Status Update Flow
Estimated code review effort: 1 (Trivial) | ~5 minutes Sequence Diagram(s)sequenceDiagram
participant UI
participant manageChannel
participant API
UI->>manageChannel: trigger enable/disable
manageChannel->>manageChannel: compute statusAfter
manageChannel->>API: POST /api/channel/:id/status {status}
API-->>manageChannel: response
manageChannel->>manageChannel: set record.status from statusAfter
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
PR #5755 (4aee5f7) made the backend reject
statusinPUT /api/channel/and migrated the default theme toPOST /api/channel/:id/status. The classic theme'smanageChannel(web/classic/src/hooks/channels/useChannelsData.jsx) was left usingPUT /api/channel/+body{status}, so enable/disable is broken under classic theme on rc.16+ — the PUT handler returns the status-field interceptor's "invalid params" error.Fix
Switch classic's enable/disable to the same
POST /api/channel/:id/statusendpoint used by the default theme.record.statusis derived from the target value (1/2) because POST returns{data: changed bool}, not a channel object.priority/weight/enable_allkeep PUT (their body has nostatusfield, so they don't trip the interceptor).Verification
web/classicon rc.16 base; grepped the minified bundle:API.post("/api/channel/"+id+"/status", {status})present (enable + disable)case "disable": data.status=2; API.put("/api/channel/", data)gonePOST /api/channel/:id/statusand the backend returns{success:true}.Note (pre-existing, not from this PR)
Classic build on current
mainis independently broken:web/classic/src/helpers/render.jsx:483importsSiSlackfromreact-icons/si, which was removed byf5bba114 chore(web): update default web dependencies. This PR is authored againstmainbut the classic bundle was verified on rc.16 (where it still builds). Happy to send the react-icons fix as a separate PR.Summary by CodeRabbit