fix(chat): don't spotlight a hidden shared-chat bubble

toggleFocus didn't check hiddenChannelIds, so tapping a hidden
bubble's chip added it to the spotlight set — fading every other
participant to showcase a channel whose own messages were already
filtered out of the feed.
This commit is contained in:
Tommy Chow 2026-07-02 23:54:36 -04:00
parent 074d8ed21f
commit 0c715d8646
2 changed files with 10 additions and 1 deletions

View file

@ -14,8 +14,11 @@ class SharedChatBubbleState {
/// Channel ids whose messages are filtered out of the feed entirely.
final hiddenChannelIds = ObservableSet<String>();
/// 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);
}

View file

@ -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');