Repository navigation
Conversation
The channel-private flag was only ever latched to true and never reset, so after visiting a private room the store kept reporting every subsequent public room as private. Downstream callers (getOlderMessages, getThreadMessages, getChannelMembers) then used the groups.* endpoints for public rooms, which responds 400 and leaves the message history empty. Set the flag to the actual room type instead of only setting it on private rooms. Fixes RocketChat#1232
|
Opened #1387 for this |
|
Hi @Spiral-Memory — a gentle nudge on this one when you have a moment. CI hasn't run yet: the workflow runs for this PR are sitting at For context, the change is a 2-line fix for #1232 ( I also have #1391 (fixes #1257) and #1394 (fixes #1158) open and in the same state — flagging them here rather than commenting on each, in case the workflow approvals can be done in one pass. No urgency on any of them, and I'm happy to address review feedback whenever it suits. |
fix: reset
isChannelPrivatewhen switching to a public roomFixes #1232
What changed
isChannelPrivatewas only ever latched on, never reset, so after visiting a private room every later public room was still treated as private and thegroups.*endpoints were used for it.Acceptance Criteria fulfillment
How it was verified
Reproduced against a local Rocket.Chat 6.13 with a public room (
GENERAL) and a private room, opening the private room first and then switching to the public one without reloading (a reload resets the store and hides the bug).GET /api/v1/groups.messages?roomId=GENERAL→ 400, the chat pane shows "No messages", and it never recovers.GET /api/v1/channels.messages?roomId=GENERAL→ 200 and the messages render in the chat pane.Known limitation
This makes the flag converge to the correct value; it does not remove every mis-targeted request.
channelInfois cached inchannelStoreand only cleared on logout, so the first request right after a room switch can still use the previous room's endpoint and 400 before it settles. RefreshingchannelInfoon room change is a larger change and I have kept it out of this PR — happy to follow up if maintainers want it here.Prior art
A previous attempt, #1234, solved this in the API layer by caching the room type from
channelInfo()and resolving the endpoint from it (getRoomRoute/resolveRoomRoute) rather than from a boolean. That approach also removes the transient request described above. It was closed unmerged by its author. This PR deliberately takes the smaller path of fixing the flag that was latching, so the change stays reviewable — but if maintainers prefer the API-layer route resolution, I am happy to implement that direction instead.Testing
yarn format:check,yarn lint(0 errors; 30 warnings, unchanged from cleandevelopat the same commit),yarn build,yarn build:storybook— all pass on Node 24 / yarn 3.6.4. The repo'spre-pushhusky hook (npm run lint) passes.No unit test added:
packages/reacthas no unit-test runner (notestscript, CI runs only format/lint/build) andsrc/index.test.jscurrently fails ondevelop— see #1191. Happy to add the tooling here or in a follow-up.Video/Screenshots
Before - switching private -> public leaves
groups.messages?roomId=GENERALat 400 and the chat pane shows "No messages":After - the same switch settles on
channels.messages?roomId=GENERAL200 and the messages render:The two
400rows still visible in the "after" capture are the transient described under Known limitation above - the final state is correct and the history loads.