Enables the use of hidden words for all visible properties of the user
This commit is contained in:
@@ -67,7 +67,9 @@ import com.vitorpamplona.quartz.utils.TimeUtils
|
|||||||
import com.vitorpamplona.quartz.utils.containsAny
|
import com.vitorpamplona.quartz.utils.containsAny
|
||||||
import kotlinx.coroutines.CancellationException
|
import kotlinx.coroutines.CancellationException
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
import kotlinx.coroutines.flow.flatMapLatest
|
||||||
import kotlinx.coroutines.suspendCancellableCoroutine
|
import kotlinx.coroutines.suspendCancellableCoroutine
|
||||||
import kotlinx.coroutines.withTimeoutOrNull
|
import kotlinx.coroutines.withTimeoutOrNull
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
@@ -764,8 +766,32 @@ open class Note(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thisEvent is BaseTextNoteEvent) {
|
if (accountChoices.hiddenWordsCase.isNotEmpty()) {
|
||||||
if (accountChoices.hiddenWordsCase.isNotEmpty() && thisEvent.content.containsAny(accountChoices.hiddenWordsCase)) {
|
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
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -848,6 +874,15 @@ class NoteFlowSet(
|
|||||||
val reports = NoteBundledRefresherFlow(u)
|
val reports = NoteBundledRefresherFlow(u)
|
||||||
val relays = 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 =
|
fun isInUse(): Boolean =
|
||||||
metadata.stateFlow.subscriptionCount.value > 0 ||
|
metadata.stateFlow.subscriptionCount.value > 0 ||
|
||||||
reports.stateFlow.subscriptionCount.value > 0 ||
|
reports.stateFlow.subscriptionCount.value > 0 ||
|
||||||
|
|||||||
+2
-1
@@ -393,9 +393,10 @@ class AccountViewModel(
|
|||||||
?: combineTransform(
|
?: combineTransform(
|
||||||
account.flowHiddenUsers,
|
account.flowHiddenUsers,
|
||||||
account.liveKind3Follows,
|
account.liveKind3Follows,
|
||||||
|
note.flow().author(),
|
||||||
note.flow().metadata.stateFlow,
|
note.flow().metadata.stateFlow,
|
||||||
note.flow().reports.stateFlow,
|
note.flow().reports.stateFlow,
|
||||||
) { hiddenUsers, followingUsers, metadata, reports ->
|
) { hiddenUsers, followingUsers, autor, metadata, reports ->
|
||||||
emit(isNoteAcceptable(metadata.note, hiddenUsers, followingUsers.users))
|
emit(isNoteAcceptable(metadata.note, hiddenUsers, followingUsers.users))
|
||||||
}.flowOn(Dispatchers.Default)
|
}.flowOn(Dispatchers.Default)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
|
|||||||
Reference in New Issue
Block a user