mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-11 11:04:22 -05:00
Don't repeatedly attempt to censor events we don't have.
Currently we don't set `have_censored` column if we don't have the target event of a redaction, which means we repeatedly attempt to censor the same non-existant event. When we persist non-redacted events we unset the `have_censored` column for any redactions that target said event.
This commit is contained in:
parent
479fbac96f
commit
a27fb7d5ca
@ -1389,6 +1389,22 @@ class EventsStore(
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
for event, _ in events_and_contexts:
|
||||||
|
if not event.internal_metadata.is_redacted():
|
||||||
|
# If we're persisting an unredacted event we go and ensure
|
||||||
|
# that we mark any redactions that reference this event as
|
||||||
|
# requiring censoring.
|
||||||
|
self._simple_update_txn(
|
||||||
|
txn,
|
||||||
|
table="redactions",
|
||||||
|
keyvalues={
|
||||||
|
"redacts": event.event_id,
|
||||||
|
},
|
||||||
|
updatevalues={
|
||||||
|
"have_censored": False,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
def _store_rejected_events_txn(self, txn, events_and_contexts):
|
def _store_rejected_events_txn(self, txn, events_and_contexts):
|
||||||
"""Add rows to the 'rejections' table for received events which were
|
"""Add rows to the 'rejections' table for received events which were
|
||||||
rejected
|
rejected
|
||||||
@ -1589,7 +1605,7 @@ class EventsStore(
|
|||||||
sql = """
|
sql = """
|
||||||
SELECT redact_event.event_id, redacts FROM redactions
|
SELECT redact_event.event_id, redacts FROM redactions
|
||||||
INNER JOIN events AS redact_event USING (event_id)
|
INNER JOIN events AS redact_event USING (event_id)
|
||||||
INNER JOIN events AS original_event ON (
|
LEFT JOIN events AS original_event ON (
|
||||||
redact_event.room_id = original_event.room_id
|
redact_event.room_id = original_event.room_id
|
||||||
AND redacts = original_event.event_id
|
AND redacts = original_event.event_id
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user