Apply hidden to boosted notes only.

This commit is contained in:
Vitor Pamplona
2023-07-21 09:05:13 -04:00
parent 676d5e9b88
commit 77057fcac5
2 changed files with 9 additions and 3 deletions

View File

@@ -571,8 +571,15 @@ open class Note(val idHex: String) {
fun isHiddenFor(accountChoices: Account.LiveHiddenUsers): Boolean {
if (event == null) return false
val isBoostedNoteHidden = if (event is GenericRepostEvent || event is RepostEvent || event is CommunityPostApprovalEvent) {
replyTo?.lastOrNull()?.isHiddenFor(accountChoices) ?: false
} else {
false
}
val isSensitive = event?.isSensitive() ?: false
return accountChoices.hiddenUsers.contains(author?.pubkeyHex) ||
return isBoostedNoteHidden ||
accountChoices.hiddenUsers.contains(author?.pubkeyHex) ||
accountChoices.spammers.contains(author?.pubkeyHex) ||
(isSensitive && accountChoices.showSensitiveContent == false)
}

View File

@@ -291,9 +291,8 @@ fun CheckHiddenNoteCompose(
nav = nav
)
} else {
val boostedNote = note.replyTo?.lastOrNull()
val isHidden by accountViewModel.account.liveHiddenUsers.map {
note.isHiddenFor(it) || boostedNote?.isHiddenFor(it) == true
note.isHiddenFor(it)
}.observeAsState(accountViewModel.isNoteHidden(note))
Crossfade(targetState = isHidden) {