Skip to content

fix(react): allow anonymous users to fetch starred and pinned messages - #1390

Open
ydvvdinesh wants to merge 1 commit into
RocketChat:developfrom
ydvvdinesh:fix/react-anonymous-starred-pinned-messages
Open

ydvvdinesh wants to merge 1 commit into
RocketChat:developfrom
ydvvdinesh:fix/react-anonymous-starred-pinned-messages

Conversation

@ydvvdinesh

@ydvvdinesh ydvvdinesh commented Oct 16, 2026 •

Copy link
Copy Markdown

fix(react): allow anonymous users to fetch starred and pinned messages

Acceptance Criteria fulfillment

  • Remove dead outer if (isUserAuthenticated) guard in useFetchChatData.js for getStarredMessages and getPinnedMessages.
  • Allow anonymousMode to fetch starred and pinned messages when unauthenticated.
  • Configure packages/react/babel.config.js to enable module transformation during test runs.
  • Add unit test suite in packages/react/src/hooks/useFetchChatDataMessages.test.js covering unauthenticated + anonymousMode, unauthenticated + standard, and authenticated states.

Description

In useFetchChatData.js, both getStarredMessages and getPinnedMessages contained an outer if (isUserAuthenticated) check wrapping an inner guard:

if (isUserAuthenticated) {
try {
if (!isUserAuthenticated && !anonymousMode) {
return;
}
const { messages } = await RCInstance.getStarredMessages();
setStarredMessages(messages);
} catch (e) { ... }
}

- Remove redundant outer if (isUserAuthenticated) guard in useFetchChatData.js so getStarredMessages and getPinnedMessages properly honor anonymousMode.

- Configure packages/react/babel.config.js to allow ES module compilation during Jest test execution.

- Add unit tests verifying message fetching in unauthenticated with anonymousMode, unauthenticated without anonymousMode, and authenticated states.

Signed-off-by: Dinesh Yadav <bawwadinesh@gmail.com>
@CLAassistant

CLAassistant commented Oct 16, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants