From f3962058dc2ce08930d9d9b2a84a14138a5395ac Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Mon, 5 Dec 2022 14:44:52 +0100 Subject: [PATCH] fix blocking accounts in thread view (#2988) --- .../tusky/components/viewthread/ViewThreadFragment.kt | 6 ++++++ .../tusky/components/viewthread/ViewThreadViewModel.kt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt index 9fe91b92..2f177b5f 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt @@ -169,6 +169,12 @@ class ViewThreadFragment : SFragment(), OnRefreshListener, StatusActionListener, } } is ThreadUiState.Success -> { + if (uiState.statuses.none { viewData -> viewData.isDetailed }) { + // no detailed statuses available, e.g. because author is blocked + activity?.finish() + return@collect + } + adapter.submitList(uiState.statuses) { if (viewModel.isInitialLoad) { viewModel.isInitialLoad = false diff --git a/app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadViewModel.kt b/app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadViewModel.kt index b4a8a03e..f4d7e14d 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadViewModel.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadViewModel.kt @@ -262,7 +262,7 @@ class ViewThreadViewModel @Inject constructor( updateSuccess { uiState -> uiState.copy( statuses = uiState.statuses.filter { viewData -> - viewData.status.account.id == accountId + viewData.status.account.id != accountId } ) }