diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Note.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Note.kt index 9392e434b..6c661d56c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Note.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/model/Note.kt @@ -67,7 +67,9 @@ import com.vitorpamplona.quartz.utils.TimeUtils import com.vitorpamplona.quartz.utils.containsAny import kotlinx.coroutines.CancellationException import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.suspendCancellableCoroutine import kotlinx.coroutines.withTimeoutOrNull import java.math.BigDecimal @@ -764,8 +766,32 @@ open class Note( } } - if (thisEvent is BaseTextNoteEvent) { - if (accountChoices.hiddenWordsCase.isNotEmpty() && thisEvent.content.containsAny(accountChoices.hiddenWordsCase)) { + if (accountChoices.hiddenWordsCase.isNotEmpty()) { + if (thisEvent is BaseTextNoteEvent && thisEvent.content.containsAny(accountChoices.hiddenWordsCase)) { + return true + } + + if (author?.toBestDisplayName()?.containsAny(accountChoices.hiddenWordsCase) == true) { + return true + } + + if (author?.profilePicture()?.containsAny(accountChoices.hiddenWordsCase) == true) { + return true + } + + if (author?.info?.banner?.containsAny(accountChoices.hiddenWordsCase) == true) { + return true + } + + if (author?.info?.about?.containsAny(accountChoices.hiddenWordsCase) == true) { + return true + } + + if (author?.info?.lud06?.containsAny(accountChoices.hiddenWordsCase) == true) { + return true + } + + if (author?.info?.lud16?.containsAny(accountChoices.hiddenWordsCase) == true) { return true } } @@ -848,6 +874,15 @@ class NoteFlowSet( val reports = NoteBundledRefresherFlow(u) val relays = NoteBundledRefresherFlow(u) + @OptIn(ExperimentalCoroutinesApi::class) + fun author() = + metadata.stateFlow.flatMapLatest { + it.note.author + ?.flow() + ?.metadata + ?.stateFlow ?: MutableStateFlow(null) + } + fun isInUse(): Boolean = metadata.stateFlow.subscriptionCount.value > 0 || reports.stateFlow.subscriptionCount.value > 0 || diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt index 0d5468805..606c3bb32 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt @@ -393,9 +393,10 @@ class AccountViewModel( ?: combineTransform( account.flowHiddenUsers, account.liveKind3Follows, + note.flow().author(), note.flow().metadata.stateFlow, note.flow().reports.stateFlow, - ) { hiddenUsers, followingUsers, metadata, reports -> + ) { hiddenUsers, followingUsers, autor, metadata, reports -> emit(isNoteAcceptable(metadata.note, hiddenUsers, followingUsers.users)) }.flowOn(Dispatchers.Default) .stateIn(