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
Author
|
Opened #1387 for this |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.