mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-27 04:56:56 +02:00
Only updates the Bookmarks and Follows flag when the sensitive content property of the account changes.
This commit is contained in:
@@ -508,9 +508,11 @@ fun NoteDropDownMenu(note: Note, popupExpanded: MutableState<Boolean>, accountVi
|
|||||||
fun WatchBookmarksFollowsAndAccount(note: Note, accountViewModel: AccountViewModel, onNew: (DropDownParams) -> Unit) {
|
fun WatchBookmarksFollowsAndAccount(note: Note, accountViewModel: AccountViewModel, onNew: (DropDownParams) -> Unit) {
|
||||||
val followState by accountViewModel.userProfile().live().follows.observeAsState()
|
val followState by accountViewModel.userProfile().live().follows.observeAsState()
|
||||||
val bookmarkState by accountViewModel.userProfile().live().bookmarks.observeAsState()
|
val bookmarkState by accountViewModel.userProfile().live().bookmarks.observeAsState()
|
||||||
val accountState by accountViewModel.accountLiveData.observeAsState()
|
val showSensitiveContent by accountViewModel.accountLiveData.map {
|
||||||
|
it.account.showSensitiveContent
|
||||||
|
}.distinctUntilChanged().observeAsState(accountViewModel.account.showSensitiveContent)
|
||||||
|
|
||||||
LaunchedEffect(key1 = followState, key2 = bookmarkState, key3 = accountState) {
|
LaunchedEffect(key1 = followState, key2 = bookmarkState, key3 = showSensitiveContent) {
|
||||||
launch(Dispatchers.IO) {
|
launch(Dispatchers.IO) {
|
||||||
val newState = DropDownParams(
|
val newState = DropDownParams(
|
||||||
isFollowingAuthor = accountViewModel.isFollowing(note.author),
|
isFollowingAuthor = accountViewModel.isFollowing(note.author),
|
||||||
@@ -518,7 +520,7 @@ fun WatchBookmarksFollowsAndAccount(note: Note, accountViewModel: AccountViewMod
|
|||||||
isPublicBookmarkNote = accountViewModel.isInPublicBookmarks(note),
|
isPublicBookmarkNote = accountViewModel.isInPublicBookmarks(note),
|
||||||
isLoggedUser = accountViewModel.isLoggedUser(note.author),
|
isLoggedUser = accountViewModel.isLoggedUser(note.author),
|
||||||
isSensitive = note.event?.isSensitive() ?: false,
|
isSensitive = note.event?.isSensitive() ?: false,
|
||||||
showSensitiveContent = accountState?.account?.showSensitiveContent
|
showSensitiveContent = showSensitiveContent
|
||||||
)
|
)
|
||||||
|
|
||||||
launch(Dispatchers.Main) {
|
launch(Dispatchers.Main) {
|
||||||
|
Reference in New Issue
Block a user