From d91b5bec66ec3e4c7ae9059b5b3f54683a515f4d Mon Sep 17 00:00:00 2001 From: Hampus Date: Sun, 6 Sep 2026 20:45:11 +0200 Subject: [PATCH] fix(app): show unread channels in muted collapsed categories (#2555) --- .../components/layout/ChannelListContent.tsx | 11 ++----- .../utils/ChannelListVisibility.test.ts | 30 ++++++++++++------- .../layout/utils/ChannelListVisibility.ts | 6 ++-- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/fluxer_app/src/features/app/components/layout/ChannelListContent.tsx b/fluxer_app/src/features/app/components/layout/ChannelListContent.tsx index e092fe2eb..f8f751dc2 100644 --- a/fluxer_app/src/features/app/components/layout/ChannelListContent.tsx +++ b/fluxer_app/src/features/app/components/layout/ChannelListContent.tsx @@ -338,9 +338,7 @@ export const ChannelListContent = observer(({guild, scrollY}: {guild: Guild; scr const unreadCount = ReadStates.getUnreadCount(channelId); const hasUnread = ReadStates.hasUnread(channelId); const mentionCount = ReadStates.getMentionCount(channelId); - const isMuted = - UserGuildSettings.isParentCategoryMuted(guild.id, channelId) || - UserGuildSettings.isChannelDirectlyMuted(guild.id, channelId); + const isMuted = UserGuildSettings.isChannelDirectlyMuted(guild.id, channelId); const channel = Channels.getChannel(channelId); const unreadBadgesLevel = channel ? UserGuildSettings.resolvedUnreadBadgesLevel({ @@ -364,9 +362,6 @@ export const ChannelListContent = observer(({guild, scrollY}: {guild: Guild; scr for (const group of channelGroups) { const isCollapsed = group.category ? (collapsedCategories?.has(group.category.id) ?? false) : false; const isNullSpace = !group.category; - const isCategoryMuted = group.category - ? UserGuildSettings.isChannelDirectlyMuted(guild.id, group.category.id) - : false; let filteredTextChannels: Array; let filteredVoiceChannels: Array; if (hideMutedChannels) { @@ -411,8 +406,8 @@ export const ChannelListContent = observer(({guild, scrollY}: {guild: Guild; scr for (const ch of filteredTextChannels) { if ( shouldShowChannelInCollapsedCategory({ - isCategoryMuted, isSelected: ch.id === showTextSelected, + isConnected: false, hasVisibleUnread: hasVisibleUnreadInChannel(ch.id), }) ) { @@ -442,8 +437,8 @@ export const ChannelListContent = observer(({guild, scrollY}: {guild: Guild; scr for (const ch of filteredVoiceChannels) { if ( shouldShowChannelInCollapsedCategory({ - isCategoryMuted, isSelected: ch.id === selectedChannelInGuildId, + isConnected: ch.id === connectedChannelId, hasVisibleUnread: hasVisibleUnreadInChannel(ch.id), }) ) { diff --git a/fluxer_app/src/features/app/components/layout/utils/ChannelListVisibility.test.ts b/fluxer_app/src/features/app/components/layout/utils/ChannelListVisibility.test.ts index a25f13b34..58259f743 100644 --- a/fluxer_app/src/features/app/components/layout/utils/ChannelListVisibility.test.ts +++ b/fluxer_app/src/features/app/components/layout/utils/ChannelListVisibility.test.ts @@ -94,27 +94,37 @@ describe('shouldShowChannelInCollapsedCategory', () => { it('keeps visible unread channels reachable in collapsed categories', () => { expect( shouldShowChannelInCollapsedCategory({ - isCategoryMuted: false, isSelected: false, + isConnected: false, hasVisibleUnread: true, }), ).toBe(true); }); - it('does not reveal unread channels from muted collapsed categories unless selected', () => { + it('keeps selected and connected channels visible without unread state', () => { expect( shouldShowChannelInCollapsedCategory({ - isCategoryMuted: true, - isSelected: false, - hasVisibleUnread: true, - }), - ).toBe(false); - expect( - shouldShowChannelInCollapsedCategory({ - isCategoryMuted: true, isSelected: true, + isConnected: false, + hasVisibleUnread: false, + }), + ).toBe(true); + expect( + shouldShowChannelInCollapsedCategory({ + isSelected: false, + isConnected: true, hasVisibleUnread: false, }), ).toBe(true); }); + + it('hides read channels in collapsed categories', () => { + expect( + shouldShowChannelInCollapsedCategory({ + isSelected: false, + isConnected: false, + hasVisibleUnread: false, + }), + ).toBe(false); + }); }); diff --git a/fluxer_app/src/features/app/components/layout/utils/ChannelListVisibility.ts b/fluxer_app/src/features/app/components/layout/utils/ChannelListVisibility.ts index 10da18706..7a1754e21 100644 --- a/fluxer_app/src/features/app/components/layout/utils/ChannelListVisibility.ts +++ b/fluxer_app/src/features/app/components/layout/utils/ChannelListVisibility.ts @@ -29,15 +29,15 @@ export function shouldShowCategoryWhenHidingMutedChannels({ } export interface CollapsedCategoryChannelVisibilityInput { - isCategoryMuted: boolean; isSelected: boolean; + isConnected: boolean; hasVisibleUnread: boolean; } export function shouldShowChannelInCollapsedCategory({ - isCategoryMuted, isSelected, + isConnected, hasVisibleUnread, }: CollapsedCategoryChannelVisibilityInput): boolean { - return isSelected || (!isCategoryMuted && hasVisibleUnread); + return isSelected || isConnected || hasVisibleUnread; }