mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-09-21 17:24:35 -04:00
Uniformize spam-checker API, part 2: check_event_for_spam (#12808)
Signed-off-by: David Teller <davidt@element.io>
This commit is contained in:
parent
4cc4229cd7
commit
28199e9357
10 changed files with 128 additions and 30 deletions
|
@ -15,6 +15,7 @@
|
|||
import logging
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import synapse
|
||||
from synapse.api.constants import MAX_DEPTH, EventContentFields, EventTypes, Membership
|
||||
from synapse.api.errors import Codes, SynapseError
|
||||
from synapse.api.room_versions import EventFormatVersions, RoomVersion
|
||||
|
@ -98,9 +99,9 @@ class FederationBase:
|
|||
)
|
||||
return redacted_event
|
||||
|
||||
result = await self.spam_checker.check_event_for_spam(pdu)
|
||||
spam_check = await self.spam_checker.check_event_for_spam(pdu)
|
||||
|
||||
if result:
|
||||
if spam_check is not synapse.spam_checker_api.Allow.ALLOW:
|
||||
logger.warning("Event contains spam, soft-failing %s", pdu.event_id)
|
||||
# we redact (to save disk space) as well as soft-failing (to stop
|
||||
# using the event in prev_events).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue