Keep message selection active when every message is unselected

Unselecting the last message used to end the selection, closing it
without the user asking. Selection mode is now its own state: Forward
starts it and it only ends with the close button, once the messages are
forwarded, when the timeline changes or the feature is turned off. With
nothing selected the forward button stays visible but disabled.
This commit is contained in:
Mauro Romito
2026-10-01 15:45:29 +02:00
committed by Mauro
parent cdb5d4ee31
commit 8ddd161625
15 changed files with 49 additions and 15 deletions
@@ -781,9 +781,14 @@ final class TimelineViewModelTests {
viewModel.process(viewAction: .toggleMessageSelection(itemID: items[0].id))
#expect(viewModel.state.messageSelection.selectedEventIDs == ["$2"])
// Deselecting the last item ends the selection.
// Deselecting the last item keeps the selection going, with nothing selected.
viewModel.process(viewAction: .toggleMessageSelection(itemID: items[1].id))
#expect(!viewModel.state.messageSelection.isActive)
#expect(viewModel.state.messageSelection.isActive)
#expect(viewModel.state.messageSelection.selectedEventIDs.isEmpty)
// Selecting again still works.
viewModel.process(viewAction: .toggleMessageSelection(itemID: items[0].id))
#expect(viewModel.state.messageSelection.selectedEventIDs == ["$1"])
}
@Test