Repository: thunderbird/thunderbird-android
File: feature/navigation/drawer/dropdown/src/main/kotlin/net/thunderbird/feature/navigation/drawer/dropdown/ui/folder/FolderListItem.kt (Kotlin)

Code before:
            modifier = Modifier.fillMaxWidth(),
            icon = {
                Icon(
                    imageVector = mapFolderIcon(displayFolder),
                )
            },
            badge = {
                FolderListItemBadge(
                    unreadCount = unreadCount,
                    starredCount = starredCount,
                    showStarredCount = showStarredCount,
                    expandableState = if (hasExpandableItems) isExpanded else null,
                )
            },
        )

        // Managing children
        if (!isExpanded.value) return
        if (treeFolder === null) return
        for (child in treeFolder.children) {
            var displayParent = treeFolder.displayFolder
            var displayChild = child.displayFolder
            if (displayChild === null) continue
            FolderListItem(
                displayFolder = displayChild,
                selected = selectedFolderId?.let { displayChild.id == selectedFolderId } ?: false,
                showStarredCount = showStarredCount,
                onClick = { onClick(displayChild) },
                folderNameFormatter = folderNameFormatter,
                modifier = Modifier
                    .fillMaxWidth()
                    .padding(start = MainTheme.spacings.double * indentationLevel),
                treeFolder = child,
                parentPrefix = if (displayParent is DisplayAccountFolder) displayParent.folder.name else null,
                indentationLevel = indentationLevel + 1,
            )
        }
    }
}

@Composable
private fun mapFolderName(
    displayFolder: DisplayFolder,
    folderNameFormatter: FolderNameFormatter,
    parentPrefix: String? = "",
): String {
    return when (displayFolder) {
        is DisplayAccountFolder -> folderNameFormatter.displayName(displayFolder.folder).removePrefix("$parentPrefix/")
        is DisplayUnifiedFolder -> mapUnifiedFolderName(displayFolder)
        else -> throw IllegalArgumentException("Unknown display folder: $displayFolder")
    }

Review comment (suggestion):
You can use equality check can be used instead of elvis for nullable boolean check:
```suggestion
                selected = selectedFolderId?.let { displayChild.id == selectedFolderId } == true,
```

Code after:
            modifier = Modifier.fillMaxWidth(),
            icon = {
                Icon(
                    imageVector = mapFolderIcon(displayFolder),
                )
            },
            badge = {
                FolderListItemBadge(
                    unreadCount = unreadCount,
                    starredCount = starredCount,
                    showStarredCount = showStarredCount,
                    expandableState = if (hasExpandableItems) isExpanded else null,
                )
            },
        )

        // Managing children
        if (!isExpanded.value) return
        if (treeFolder === null) return
        for (child in treeFolder.children) {
            var displayParent = treeFolder.displayFolder
            var displayChild = child.displayFolder
            if (displayChild === null) continue
            FolderListItem(
                displayFolder = displayChild,
                selected = selectedFolderId?.let { displayChild.id == selectedFolderId } == true,
                showStarredCount = showStarredCount,
                onClick = { onClick(displayChild) },
                folderNameFormatter = folderNameFormatter,
                modifier = Modifier
                    .fillMaxWidth()
                    .padding(start = MainTheme.spacings.double * indentationLevel),
                treeFolder = child,
                parentPrefix = if (displayParent is DisplayAccountFolder) displayParent.folder.name else null,
                indentationLevel = indentationLevel + 1,
            )
        }
    }
}

@Composable
private fun mapFolderName(
    displayFolder: DisplayFolder,
    folderNameFormatter: FolderNameFormatter,
    parentPrefix: String? = "",
): String {
    return when (displayFolder) {
        is DisplayAccountFolder -> folderNameFormatter.displayName(displayFolder.folder).removePrefix("$parentPrefix/")
        is DisplayUnifiedFolder -> mapUnifiedFolderName(displayFolder)
        else -> throw IllegalArgumentException("Unknown display folder: $displayFolder")
    }