2021-07-05 13:23:03 +02:00
|
|
|
package federation
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/superseriousbusiness/gotosocial/internal/db"
|
|
|
|
|
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func (f *federator) blockedDomain(host string) (bool, error) {
|
|
|
|
|
b := >smodel.DomainBlock{}
|
|
|
|
|
err := f.db.GetWhere([]db.Where{{Key: "domain", Value: host, CaseInsensitive: true}}, b)
|
|
|
|
|
if err == nil {
|
|
|
|
|
// block exists
|
|
|
|
|
return true, nil
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-17 15:23:28 +02:00
|
|
|
if err == db.ErrNoEntries {
|
2021-07-05 13:23:03 +02:00
|
|
|
// there are no entries so there's no block
|
|
|
|
|
return false, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// there's an actual error
|
|
|
|
|
return false, err
|
|
|
|
|
}
|