diff --git a/lib/screens/channel/chat/stores/shared_chat_bubble_state.dart b/lib/screens/channel/chat/stores/shared_chat_bubble_state.dart index 825c3ed4..6d18c655 100644 --- a/lib/screens/channel/chat/stores/shared_chat_bubble_state.dart +++ b/lib/screens/channel/chat/stores/shared_chat_bubble_state.dart @@ -14,8 +14,11 @@ class SharedChatBubbleState { /// Channel ids whose messages are filtered out of the feed entirely. final hiddenChannelIds = ObservableSet(); - /// Adds/removes [channelId] from the spotlight set. + /// Adds/removes [channelId] from the spotlight set. No-ops for a hidden + /// channel — its messages are filtered out, so spotlighting it would fade + /// every other channel to showcase nothing. void toggleFocus(String channelId) { + if (hiddenChannelIds.contains(channelId)) return; if (!focusedChannelIds.remove(channelId)) { focusedChannelIds.add(channelId); } diff --git a/test/screens/channel/chat/shared_chat_bubble_state_test.dart b/test/screens/channel/chat/shared_chat_bubble_state_test.dart index 7c12a727..65a2b927 100644 --- a/test/screens/channel/chat/shared_chat_bubble_state_test.dart +++ b/test/screens/channel/chat/shared_chat_bubble_state_test.dart @@ -35,6 +35,12 @@ void main() { expect(state.isFocused('1'), isFalse); }); + test('toggleFocus is a no-op for a hidden channel', () { + state.hide('1'); + state.toggleFocus('1'); + expect(state.isFocused('1'), isFalse); + }); + test('show lifts a hide', () { state.hide('1'); state.show('1');