summaryrefslogtreecommitdiff
path: root/internal/visibility/statusvisible.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/visibility/statusvisible.go')
-rw-r--r--internal/visibility/statusvisible.go27
1 files changed, 24 insertions, 3 deletions
diff --git a/internal/visibility/statusvisible.go b/internal/visibility/statusvisible.go
index c022be359..dc6b74702 100644
--- a/internal/visibility/statusvisible.go
+++ b/internal/visibility/statusvisible.go
@@ -19,9 +19,20 @@ func (f *filter) StatusVisible(targetStatus *gtsmodel.Status, requestingAccount
relevantAccounts, err := f.pullRelevantAccountsFromStatus(targetStatus)
if err != nil {
l.Debugf("error pulling relevant accounts for status %s: %s", targetStatus.ID, err)
+ return false, fmt.Errorf("error pulling relevant accounts for status %s: %s", targetStatus.ID, err)
+ }
+
+ domainBlocked, err := f.domainBlockedRelevant(relevantAccounts)
+ if err != nil {
+ l.Debugf("error checking domain block: %s", err)
+ return false, fmt.Errorf("error checking domain block: %s", err)
}
- targetAccount := relevantAccounts.StatusAuthor
+ if domainBlocked {
+ return false, nil
+ }
+
+ targetAccount := relevantAccounts.StatusAuthor
// if target account is suspended then don't show the status
if !targetAccount.SuspendedAt.IsZero() {
l.Trace("target account suspended at is not zero")
@@ -123,8 +134,8 @@ func (f *filter) StatusVisible(targetStatus *gtsmodel.Status, requestingAccount
}
// status boosts accounts id
- if relevantAccounts.BoostedAccount != nil {
- if blocked, err := f.db.Blocked(relevantAccounts.BoostedAccount.ID, requestingAccount.ID); err != nil {
+ if relevantAccounts.BoostedStatusAuthor != nil {
+ if blocked, err := f.db.Blocked(relevantAccounts.BoostedStatusAuthor.ID, requestingAccount.ID); err != nil {
return false, err
} else if blocked {
l.Trace("a block exists between requesting account and boosted account")
@@ -152,6 +163,16 @@ func (f *filter) StatusVisible(targetStatus *gtsmodel.Status, requestingAccount
}
}
+ // boost mentions accounts
+ for _, a := range relevantAccounts.BoostedMentionedAccounts {
+ if blocked, err := f.db.Blocked(a.ID, requestingAccount.ID); err != nil {
+ return false, err
+ } else if blocked {
+ l.Trace("a block exists between requesting account and a boosted mentioned account")
+ return false, nil
+ }
+ }
+
// if the requesting account is mentioned in the status it should always be visible
for _, acct := range relevantAccounts.MentionedAccounts {
if acct.ID == requestingAccount.ID {