1
0
Fork 0

Fixes #6341: Initialize 'selectedTabs' based on opened/selected tabs.

The problem was that the parameter 'selectedTabIds' was not taken into account
when initializing the variable 'selectedTabs'. So I made the initialization
based on both the selected tab and the number of open tabs.
master
ValentinTimisica 2019-10-31 16:16:33 +02:00 committed by Emily Kager
parent da521bc37c
commit 34959a434f
1 changed files with 6 additions and 1 deletions

View File

@ -47,7 +47,12 @@ class CollectionCreationFragment : DialogFragment() {
val sessionManager = requireComponents.core.sessionManager
val publicSuffixList = requireComponents.publicSuffixList
val tabs = sessionManager.getTabs(args.tabIds, publicSuffixList)
val selectedTabs = if (tabs.size == 1) setOf(tabs.first()) else emptySet()
val selectedTabs = if (args.selectedTabIds != null) {
sessionManager.getTabs(args.selectedTabIds, publicSuffixList).toSet()
} else {
if (tabs.size == 1) setOf(tabs.first()) else emptySet()
}
val tabCollections = requireComponents.core.tabCollectionStorage.cachedTabCollections
val selectedTabCollection = args.selectedTabCollectionId
.let { id -> tabCollections.firstOrNull { it.id == id } }