A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
fix(app): show unread channels in muted collapsed categories (#2555)
Hampusd91b5bec66ec
diff --git a/fluxer_app/src/features/app/components/layout/ChannelListContent.tsx b/fluxer_app/src/features/app/components/layout/ChannelListContent.tsxindex 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; scrconst 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; scrfor (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<Channel>;let filteredVoiceChannels: Array<Channel>;if (hideMutedChannels) {@@ -411,8 +406,8 @@ export const ChannelListContent = observer(({guild, scrollY}: {guild: Guild; scrfor (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; scrfor (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.tsindex 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,+ isSelected: true,+ isConnected: false,+ hasVisibleUnread: false,}),- ).toBe(false);+ ).toBe(true);expect(shouldShowChannelInCollapsedCategory({- isCategoryMuted: true,- isSelected: true,+ 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.tsindex 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;}