Skip to content

fix: conditionally render room archived warning in room information - #1404

Open
swarnendusahu10-dotcom wants to merge 1 commit into
RocketChat:developfrom
swarnendusahu10-dotcom:fix/issue-1109-incorrect-room-archived-status
Open

swarnendusahu10-dotcom wants to merge 1 commit into
RocketChat:developfrom
swarnendusahu10-dotcom:fix/issue-1109-incorrect-room-archived-status

Conversation

@swarnendusahu10-dotcom

Copy link
Copy Markdown
Contributor

Summary

Closes #1109.

Fixes an issue where the Room Information sidebar unconditionally displayed the "Room Archived" warning banner across all channels, regardless of their actual archived status.


Problem (Before)

In packages/react/src/views/RoomInformation/RoomInformation.js:

<Box css={styles.infoContainer}>
  <Box css={styles.archivedRoomInfo}>
    <Icon name="report" ... />
    <Box css={styles.archivedText}>Room Archived</Box>
  </Box>
</Box>

@Spiral-Memory Spiral-Memory left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

const channelInfo = useChannelStore((state) => state.channelInfo);
const isChannelPrivate = useChannelStore((state) => state.isChannelPrivate);
const isRoomTeam = useChannelStore((state) => state.isRoomTeam);
const isChannelArchived = useChannelStore((state) => state.isChannelArchived);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this store already exist and manage it internally?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly! useChannelStore (packages/react/src/store/channelStore.js) already defines isChannelArchived: false and setIsChannelArchived.

In ChatHeader.js (lines 95–96 & 297), when the room returns an error-room-archived response, it calls setIsChannelArchived(true) and stores the room metadata in channelInfo.

Previously, RoomInformation.js subscribed to channelInfo, isChannelPrivate, and isRoomTeam from useChannelStore, but isChannelArchived was missing and the warning banner was rendered unconditionally for every room. This fix simply connects the existing store property and room metadata (channelInfo?.archived || isChannelArchived) to conditionally render the banner as originally intended.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for reviewing and approving @Spiral-Memory! Really appreciate the feedback. 🙌

Looking forward to the merge whenever you get a chance @Aryan-Verma-999!

@Spiral-Memory

Copy link
Copy Markdown
Collaborator

@Aryan-Verma-999 Feel free to merge if looks good to you

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.

Bug: Incorrect "Room Archived" Status

2 participants