Merge pull request #7445 from thunderbird/special_folders_fix_2

Sort folders alphabetically in special folders screen
This commit is contained in:
cketti 2024-01-03 13:14:34 +01:00 committed by GitHub
commit d3c7ec39aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 7 deletions

View file

@ -24,6 +24,10 @@ class GetSpecialFolderOptions(
?: error("No incoming server settings available")
val remoteFolders = folderFetcher.getFolders(serverSettings, authStateStorage)
.sortedWith(
compareByDescending<RemoteFolder> { it.type == FolderType.INBOX }
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.displayName },
)
SpecialFolderOptions(
archiveSpecialFolderOptions = mapByFolderType(FolderType.ARCHIVE, remoteFolders),

View file

@ -124,31 +124,31 @@ class GetSpecialFolderOptionsTest {
assertThat(folders.archiveSpecialFolderOptions[0]).isEqualTo(
SpecialFolderOption.Special(
remoteFolder = ARCHIVE_FOLDER_2,
remoteFolder = ARCHIVE_FOLDER_1,
isAutomatic = true,
),
)
assertThat(folders.draftsSpecialFolderOptions[0]).isEqualTo(
SpecialFolderOption.Special(
remoteFolder = DRAFTS_FOLDER_2,
remoteFolder = DRAFTS_FOLDER_1,
isAutomatic = true,
),
)
assertThat(folders.sentSpecialFolderOptions[0]).isEqualTo(
SpecialFolderOption.Special(
remoteFolder = SENT_FOLDER_2,
remoteFolder = SENT_FOLDER_1,
isAutomatic = true,
),
)
assertThat(folders.spamSpecialFolderOptions[0]).isEqualTo(
SpecialFolderOption.Special(
remoteFolder = SPAM_FOLDER_2,
remoteFolder = SPAM_FOLDER_1,
isAutomatic = true,
),
)
assertThat(folders.trashSpecialFolderOptions[0]).isEqualTo(
SpecialFolderOption.Special(
remoteFolder = TRASH_FOLDER_2,
remoteFolder = TRASH_FOLDER_1,
isAutomatic = true,
),
)
@ -299,6 +299,8 @@ class GetSpecialFolderOptionsTest {
SpecialFolderOption.Special(
remoteFolder = DRAFTS_FOLDER_1,
),
SpecialFolderOption.Regular(REGULAR_FOLDER_1),
SpecialFolderOption.Regular(REGULAR_FOLDER_2),
SpecialFolderOption.Special(
remoteFolder = SENT_FOLDER_1,
),
@ -308,8 +310,6 @@ class GetSpecialFolderOptionsTest {
SpecialFolderOption.Special(
remoteFolder = TRASH_FOLDER_1,
),
SpecialFolderOption.Regular(REGULAR_FOLDER_1),
SpecialFolderOption.Regular(REGULAR_FOLDER_2),
).toTypedArray()
}