fix(chat): ao fechar a conversa, a sala geral volta a ser o destino

O fechamento da aba não avisava a seleção da sala, então o menu e o texto continuavam os do peer.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Gabriel Felipe Souza SantosandCursor committed 2026-11-04 00:13:45 -03:00
1 parent 9610c07675
commit beaf9190c9
2 files changed
+22 -1

No files matched your search

@@ -201,7 +201,8 @@ public final class ClosableTabbedPane {
next = firstTabKey();
}
if (next != null) {
selectTab(next);
selectTabSilently(next);
onTabSelected.accept(next);
} else if (!suppressSelectionEvents) {
onTabSelected.accept(null);
}
@@ -3,6 +3,8 @@ package pitiupi.presentation.shell;
import org.junit.jupiter.api.Test;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -78,4 +80,22 @@ class SessionTabBarStripTest {
assertEquals(1, bar.getTabCount());
assertEquals(false, bar.hasTab(wifi));
}
@Test
void closingPeerTabNotifiesRoomEvenWhenItWasAlreadyUnderneath() {
SessionTabBar bar = new SessionTabBar();
List<String> selected = new ArrayList<>();
bar.setOnTabSelected(selected::add);
bar.addOrSelectTab(PluginSessionKeys.ROOM, "Sala geral", new JPanel(), false);
String peer = PluginSessionKeys.peer("192.168.3.131");
bar.addOrSelectTab(peer, "Vostro", "192.168.3.131", new JPanel(), true);
bar.selectTab(PluginSessionKeys.ROOM);
bar.selectTab(peer);
selected.clear();
bar.closeTab(peer);
assertEquals(PluginSessionKeys.ROOM, bar.selectedKey());
assertEquals(List.of(PluginSessionKeys.ROOM), selected);
}
}