From 712965cc8fe7558db82f4c5521fe424705a0214c Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Tue, 4 Nov 2025 19:50:57 -0500 Subject: [PATCH] Fixes the unfollow button on profile (removes the follow signal including all lists for now) Also fixes spacing of the Follow button --- .../relayClient/reqCommand/user/UserObservers.kt | 13 ++----------- .../amethyst/ui/note/ZapNoteCompose.kt | 2 +- .../ui/screen/loggedIn/profile/FollowButtons.kt | 2 +- .../profile/header/DisplayFollowUnfollowButton.kt | 2 +- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/user/UserObservers.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/user/UserObservers.kt index 272c6d0d3..4c0f03999 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/user/UserObservers.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/relayClient/reqCommand/user/UserObservers.kt @@ -411,15 +411,6 @@ fun observeUserIsFollowing( ): State { // Subscribe in the relay for changes in the metadata of this user. UserFinderFilterAssemblerSubscription(user1, accountViewModel) - val isUserInFollowSets = - remember(accountViewModel.account.peopleListsState) { - // Only check follow sets if user1 is the logged-in user - if (user1 == accountViewModel.account.userProfile()) { - accountViewModel.account.peopleListsState.isUserInFollowSets(user2) - } else { - false - } - } // Subscribe in the LocalCache for changes that arrive in the device val flow = @@ -429,13 +420,13 @@ fun observeUserIsFollowing( .follows.stateFlow .sample(1000) .mapLatest { userState -> - userState.user.isFollowing(user2) || isUserInFollowSets + userState.user.isFollowing(user2) }.distinctUntilChanged() .flowOn(Dispatchers.IO) } return flow.collectAsStateWithLifecycle( - user1.isFollowing(user2) || isUserInFollowSets, + user1.isFollowing(user2), ) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapNoteCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapNoteCompose.kt index 6dd97fd55..bacbcfd81 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapNoteCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapNoteCompose.kt @@ -177,7 +177,7 @@ fun ShowFollowingOrUnfollowingButton( baseAuthor: User, accountViewModel: AccountViewModel, ) { - var isFollowing = observeUserIsFollowing(accountViewModel.account.userProfile(), baseAuthor, accountViewModel) + val isFollowing = observeUserIsFollowing(accountViewModel.account.userProfile(), baseAuthor, accountViewModel) if (isFollowing.value) { UnfollowButton { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/FollowButtons.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/FollowButtons.kt index 94f1fb792..94c9f6070 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/FollowButtons.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/FollowButtons.kt @@ -41,7 +41,7 @@ fun FollowButton( onClick: () -> Unit, ) { FilledTonalButton( - modifier = Modifier.padding(start = 3.dp), + modifier = Modifier.padding(horizontal = 3.dp), onClick = onClick, shape = if (isInProfileActions) LeftHalfCircleButtonBorder else ButtonBorder, contentPadding = ButtonPadding, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/DisplayFollowUnfollowButton.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/DisplayFollowUnfollowButton.kt index 075e03916..0bf1d7d7c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/DisplayFollowUnfollowButton.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/DisplayFollowUnfollowButton.kt @@ -61,7 +61,7 @@ fun DisplayFollowUnfollowButton( } } } else { - FollowButton(R.string.follow, true) { + FollowButton(R.string.follow, isInProfileActions = true) { if (!accountViewModel.isWriteable()) { accountViewModel.toastManager.toast( R.string.read_only_user,