Merge pull request #3337 from vitorpamplona/claude/peaceful-mendel-drkneu

Show blocked/muted user indicator on profile tabs
This commit is contained in:
Vitor Pamplona
2026-06-22 15:43:50 -04:00
committed by GitHub
3 changed files with 63 additions and 2 deletions
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2025 Vitor Pamplona
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.vitorpamplona.amethyst.ui.feeds
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import com.vitorpamplona.amethyst.R
import com.vitorpamplona.amethyst.ui.stringRes
import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer
@Composable
fun UserBlockedFeed(onUnblock: () -> Unit) {
Column(
Modifier.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
) {
Text(stringRes(R.string.user_is_blocked_hidden))
Spacer(modifier = StdVertSpacer)
OutlinedButton(onClick = onUnblock) { Text(text = stringRes(R.string.unblock_user)) }
}
}
@@ -67,6 +67,7 @@ import com.vitorpamplona.amethyst.R
import com.vitorpamplona.amethyst.model.LocalCache
import com.vitorpamplona.amethyst.model.User
import com.vitorpamplona.amethyst.service.relayClient.reqCommand.account.observeAccountIsHiddenUser
import com.vitorpamplona.amethyst.ui.feeds.UserBlockedFeed
import com.vitorpamplona.amethyst.ui.feeds.WatchLifecycleAndUpdateModel
import com.vitorpamplona.amethyst.ui.navigation.bottombars.AppBottomBar
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
@@ -588,9 +589,21 @@ private fun CreateAndRenderPages(
accountViewModel,
)
val isHidden by observeAccountIsHiddenUser(accountViewModel.account, baseUser)
when (tab) {
ProfileTab.Notes -> TabNotesNewThreads(threadsViewModel, pinnedNotesFeedViewModel, accountViewModel, nav)
ProfileTab.Replies -> TabNotesConversations(repliesViewModel, accountViewModel, nav)
ProfileTab.Notes ->
if (isHidden) {
UserBlockedFeed { accountViewModel.show(baseUser) }
} else {
TabNotesNewThreads(threadsViewModel, pinnedNotesFeedViewModel, accountViewModel, nav)
}
ProfileTab.Replies ->
if (isHidden) {
UserBlockedFeed { accountViewModel.show(baseUser) }
} else {
TabNotesConversations(repliesViewModel, accountViewModel, nav)
}
ProfileTab.Mutual -> TabMutualConversations(mutualViewModel, accountViewModel, nav)
ProfileTab.Gallery -> TabGallery(galleryFeedViewModel, accountViewModel, nav)
ProfileTab.Follows -> TabFollows(followsFeedViewModel, accountViewModel, nav)
+1
View File
@@ -281,6 +281,7 @@
<string name="unblock">Unblock</string>
<string name="copy_user_id">Copy User ID</string>
<string name="unblock_user">Unblock User</string>
<string name="user_is_blocked_hidden">This user is blocked/muted. Their posts are hidden.</string>
<string name="npub_hex_username">"npub, username, text"</string>
<string name="clear">Clear</string>
<string name="app_logo">App Logo</string>