keep status state in thread view after refreshing (#2855)
* keep status state in thread view after refreshing * add clarifying parentheses
This commit is contained in:
parent
199947ae04
commit
61a1baf533
|
@ -366,11 +366,12 @@ class ViewThreadViewModel @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Status.toViewData(detailed: Boolean = false): StatusViewData.Concrete {
|
private fun Status.toViewData(detailed: Boolean = false): StatusViewData.Concrete {
|
||||||
|
val oldStatus = (_uiState.value as? ThreadUiState.Success)?.statuses?.find { it.id == this.id }
|
||||||
return toViewData(
|
return toViewData(
|
||||||
isShowingContent = alwaysShowSensitiveMedia || !actionableStatus.sensitive,
|
isShowingContent = oldStatus?.isShowingContent ?: (alwaysShowSensitiveMedia || !actionableStatus.sensitive),
|
||||||
isExpanded = alwaysOpenSpoiler,
|
isExpanded = oldStatus?.isExpanded ?: alwaysOpenSpoiler,
|
||||||
isCollapsed = !detailed,
|
isCollapsed = oldStatus?.isCollapsed ?: !detailed,
|
||||||
isDetailed = detailed
|
isDetailed = oldStatus?.isDetailed ?: detailed
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue