From b68e9760fbf1e064b256512ab3a9d7885c114558 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Tue, 6 Aug 2024 20:10:38 +0200 Subject: [PATCH] fix translating boosts in home timeline (#4590) fixes https://github.com/tuskyapp/Tusky/issues/4589 --- .../timeline/viewmodel/CachedTimelineViewModel.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/CachedTimelineViewModel.kt b/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/CachedTimelineViewModel.kt index dbc086342..95015be26 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/CachedTimelineViewModel.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/CachedTimelineViewModel.kt @@ -284,19 +284,18 @@ class CachedTimelineViewModel @Inject constructor( } override suspend fun translate(status: StatusViewData.Concrete): NetworkResult { - translations.value = translations.value + (status.id to TranslationViewData.Loading) + translations.value += (status.id to TranslationViewData.Loading) return timelineCases.translate(status.actionableId) .map { translation -> - translations.value = - translations.value + (status.id to TranslationViewData.Loaded(translation)) + translations.value += (status.actionableId to TranslationViewData.Loaded(translation)) } .onFailure { - translations.value = translations.value - status.id + translations.value -= status.actionableId } } override fun untranslate(status: StatusViewData.Concrete) { - translations.value = translations.value - status.id + translations.value -= status.actionableId } companion object {