Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscriptions list ignores case when sorting #1457

Merged
merged 1 commit into from Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -4,8 +4,6 @@ import androidx.activity.compose.BackHandler
import androidx.compose.material3.DrawerState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import com.jerboa.api.ApiState
import com.jerboa.closeDrawer
Expand All @@ -18,7 +16,6 @@ import com.jerboa.model.HomeViewModel
import com.jerboa.model.SiteViewModel
import com.jerboa.ui.components.common.getCurrentAccount
import com.jerboa.ui.components.home.NavTab
import it.vercruysse.lemmyapi.v0x19.datatypes.CommunityFollowerView
import it.vercruysse.lemmyapi.v0x19.datatypes.CommunityId
import kotlinx.coroutines.CoroutineScope

Expand All @@ -39,8 +36,6 @@ fun MainDrawer(
) {
val account = getCurrentAccount(accountViewModel)

var follows by remember { mutableStateOf(listOf<CommunityFollowerView>()) }

BackHandler(drawerState.isOpen) {
closeDrawer(scope, drawerState)
}
Expand All @@ -53,7 +48,6 @@ fun MainDrawer(
if (!account.isAnon() && account.isReady() && res.data.my_user == null) {
accountViewModel.invalidateAccount(account)
}
follows = res.data.my_user?.follows?.sortedBy { it.community.title }.orEmpty()
res.data.my_user
}
is ApiState.Failure -> {
Expand All @@ -66,7 +60,12 @@ fun MainDrawer(
}
else -> null
},
follows = follows.toList(),
follows = when (val res = siteViewModel.siteRes) {
is ApiState.Success -> {
res.data.my_user?.follows?.sortedBy { it.community.title.lowercase() }.orEmpty()
}
else -> emptyList()
},
unreadCount = siteViewModel.unreadCount,
unreadAppCount = siteViewModel.unreadAppCount,
unreadReportCount = siteViewModel.unreadReportCount,
Expand Down