Skip to content

fix(desktop): show private/forum icons in channel browser rows - #6205

Open
santhiprakash wants to merge 1 commit into
block:mainfrom
santhiprakash:fix/desktop-channel-browser-private-visibility-6120
Open

fix(desktop): show private/forum icons in channel browser rows#6205
santhiprakash wants to merge 1 commit into
block:mainfrom
santhiprakash:fix/desktop-channel-browser-private-visibility-6120

Conversation

@santhiprakash

Copy link
Copy Markdown

Fixes #6120.

Summary

The Add Channel dialog (ChannelBrowserDialog) 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.

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 # — the same precedence SidebarChannelIcon had.

Evidence

Checked against main @ 978e585e8 (chore(release): release Buzz Desktop version 0.5.16 (#6191)):

  • ChannelBrowserDialog.tsx:792-798 was emitting a literal # regardless of channel kind.
  • SidebarSection.tsx:242-244 already showed a Lock for visibility === private and a FileText for channelType === forum.

Reproduce

  1. Create or join a private channel and a public channel in the same community.
  2. Open the channel browser (Add channel).
  3. Both rows show #. Nothing marks the private one as private.
  4. The sidebar shows a lock on the private channel.

Expected

The browser row uses the same icon logic as the sidebar: lock for visibility === private, FileText for forum channels, # otherwise. Extracting the existing sidebar helper keeps the two views from drifting again.

Testing

cd desktop && node --import ./test-loader.mjs --experimental-strip-types \
  --test src/features/channels/ui/ChannelRowIcon.test.mjs

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.json is clean. The existing SidebarSection.test.mjs still passes (no behavior change for that surface — the helper now lives in ChannelRowIcon.tsx but is imported from the same place).

Notes

  • No screenshot: the icons are already present in the sidebar and the change makes the browser match it — the sidebar is the reference.
  • Pure refactor of SidebarChannelIcon's icon switch into the shared helper; no behavior change for the sidebar surface.
  • File-by-file:
    • +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 with ChannelRowIcon.
    • ~desktop/src/features/sidebar/ui/SidebarSection.tsx: replace inline SidebarChannelIcon switch with ChannelRowIcon, drop three unused lucide-react imports.

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>
@santhiprakash
santhiprakash requested a review from a team as a code owner August 18, 2026 11:24
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.

Desktop: channel browser renders every channel with '#' — private channels are indistinguishable from open ones (sidebar shows a lock)

1 participant