Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter packages logic for checking whether given statuses should be considered spam.
func (*Filter) StatusableOK ¶
func (f *Filter) StatusableOK( ctx context.Context, receiver *gtsmodel.Account, requester *gtsmodel.Account, statusable ap.Statusable, ) error
StatusableOK returns no error if the given statusable looks OK, ie., relevant to the receiver, and not spam.
This should only be used for Creates of statusables, NOT Announces!
If the statusable does not pass relevancy or spam checks, either a Spam or NotRelevant error will be returned. Callers should use gtserror.IsSpam() and gtserror.IsNotRelevant() to check for this.
If the returned error is not nil, but neither Spam or NotRelevant, then it's an actual database error.
The decision is made based on the following heuristics, in order:
- Receiver follow requester. Return nil.
- Statusable doesn't mention receiver. Return NotRelevant.
If instance-federation-spam-filter = false, then return nil now. Otherwise check:
- Receiver is locked and is followed by requester. Return nil.
- Five or more people are mentioned. Return Spam.
- Receiver follow (requests) a mentioned account. Return nil.
- Statusable has a media attachment. Return Spam.
- Statusable contains non-mention, non-hashtag links. Return Spam.