fix translating boosts in home timeline (#4590)
fixes https://github.com/tuskyapp/Tusky/issues/4589
This commit is contained in:
parent
17c50b0829
commit
b68e9760fb
|
@ -284,19 +284,18 @@ class CachedTimelineViewModel @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun translate(status: StatusViewData.Concrete): NetworkResult<Unit> {
|
override suspend fun translate(status: StatusViewData.Concrete): NetworkResult<Unit> {
|
||||||
translations.value = translations.value + (status.id to TranslationViewData.Loading)
|
translations.value += (status.id to TranslationViewData.Loading)
|
||||||
return timelineCases.translate(status.actionableId)
|
return timelineCases.translate(status.actionableId)
|
||||||
.map { translation ->
|
.map { translation ->
|
||||||
translations.value =
|
translations.value += (status.actionableId to TranslationViewData.Loaded(translation))
|
||||||
translations.value + (status.id to TranslationViewData.Loaded(translation))
|
|
||||||
}
|
}
|
||||||
.onFailure {
|
.onFailure {
|
||||||
translations.value = translations.value - status.id
|
translations.value -= status.actionableId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun untranslate(status: StatusViewData.Concrete) {
|
override fun untranslate(status: StatusViewData.Concrete) {
|
||||||
translations.value = translations.value - status.id
|
translations.value -= status.actionableId
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
Loading…
Reference in New Issue