mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-17 20:03:02 -06:00
check domain blocks way earlier on
This commit is contained in:
parent
99eb3bf564
commit
5bf7b46cf4
19 changed files with 255 additions and 77 deletions
|
|
@ -2,7 +2,6 @@ package visibility
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
|
||||
"fmt"
|
||||
|
||||
|
|
@ -17,21 +16,23 @@ func (f *filter) StatusVisible(targetStatus *gtsmodel.Status, requestingAccount
|
|||
"statusID": targetStatus.ID,
|
||||
})
|
||||
|
||||
uri, err := url.Parse(targetStatus.URI)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("StatusVisible: error parsing uri: %s", targetStatus.URI)
|
||||
}
|
||||
if blocked, err := f.blockedDomain(uri.Host); blocked || err != nil {
|
||||
l.Debugf("domain %s is blocked", uri.Host)
|
||||
return blocked, err
|
||||
}
|
||||
aaaaaaaaaa
|
||||
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)
|
||||
}
|
||||
targetAccount := relevantAccounts.StatusAuthor
|
||||
|
||||
domainBlocked, err := f.blockedRelevant(relevantAccounts)
|
||||
if err != nil {
|
||||
l.Debugf("error checking domain block: %s", err)
|
||||
return false, fmt.Errorf("error checking domain block: %s", err)
|
||||
}
|
||||
|
||||
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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue