fix(desktop): show private/forum icons in channel browser rows - #6205
Open
santhiprakash wants to merge 1 commit into
Open
fix(desktop): show private/forum icons in channel browser rows#6205santhiprakash wants to merge 1 commit into
santhiprakash wants to merge 1 commit into
Conversation
The Add Channel dialog rendered every row with a hardcoded '#' prefix, ignoring channel.visibility and channel.channelType. The sidebar already shows a lock for private channels and a file icon for forum channels; the channel browser drifted away from that and the same channel looked different in two surfaces of the same window (block#6120). Extract the icon-switching logic into a shared ChannelRowIcon component with a pure getChannelRowIconKind() helper for unit testing, and reuse it from both ChannelBrowserDialog and SidebarSection so the two views can't drift again. Visibility precedence stays: private always wins, then forum, then the default '#'. Tests cover the helper directly and render the component under JSDOM to assert the right lucide-* class reaches the DOM for each channel kind. Signed-off-by: Santhi Prakash <b.santhiprakash@gmail.com>
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.
Fixes #6120.
Summary
The Add Channel dialog (
ChannelBrowserDialog) rendered every row with a hardcoded#prefix, ignoringchannel.visibilityandchannel.channelType. The sidebar already shows a lock for private channels and a file icon for forum channels; the channel browser drifted away from that and the same channel looked different in two surfaces of the same window.Extract the icon-switching logic into a shared
ChannelRowIconcomponent with a puregetChannelRowIconKind()helper for unit testing, and reuse it from bothChannelBrowserDialogandSidebarSectionso the two views can't drift again.Visibility precedence stays:
privatealways wins, thenforum, then the default#— the same precedenceSidebarChannelIconhad.Evidence
Checked against
main@978e585e8(chore(release): release Buzz Desktop version 0.5.16 (#6191)):ChannelBrowserDialog.tsx:792-798was emitting a literal#regardless of channel kind.SidebarSection.tsx:242-244already showed aLockforvisibility === privateand aFileTextforchannelType === forum.Reproduce
#. Nothing marks the private one as private.Expected
The browser row uses the same icon logic as the sidebar: lock for
visibility === private,FileTextfor forum channels,#otherwise. Extracting the existing sidebar helper keeps the two views from drifting again.Testing
6/6 pass. The helper is tested directly (
getChannelRowIconKind) and the component is rendered under JSDOM + @testing-library/react to assert the right lucide-* class reaches the DOM for each channel kind.tsc --noEmit -p tsconfig.jsonis clean. The existingSidebarSection.test.mjsstill passes (no behavior change for that surface — the helper now lives inChannelRowIcon.tsxbut is imported from the same place).Notes
SidebarChannelIcon's icon switch into the shared helper; no behavior change for the sidebar surface.+desktop/src/features/channels/ui/ChannelRowIcon.tsx(new): 36 lines.+desktop/src/features/channels/ui/ChannelRowIcon.test.mjs(new): 110 lines.~desktop/src/features/channels/ui/ChannelBrowserDialog.tsx: replace hardcoded#span withChannelRowIcon.~desktop/src/features/sidebar/ui/SidebarSection.tsx: replace inlineSidebarChannelIconswitch withChannelRowIcon, drop three unused lucide-react imports.