aboutsummaryrefslogtreecommitdiff
path: root/roomserver/api
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-07-08 17:45:39 +0100
committerGitHub <noreply@github.com>2020-07-08 17:45:39 +0100
commitd9648b0615f3a7b1d8a824777783f19fa46697f4 (patch)
treeef31525f671b96e8e765fbb3cd3f325d8a9ee8a7 /roomserver/api
parenta5a51b41416e9b1d8084dbc759dff735133817fa (diff)
Finish implementing redactions (#1189)
* Add a bit more logging to the fedsender * bugfix: continue sending PDUs if ones are added whilst sending another PDU Without this, the queue goes back to sleep on `<-oq.notifyPDUs` which won't fire because `pendingPDUs` is already > 0. This should fix a flakey sytest. * Break if no txn is sent * WIP syncapi work * More debugging * Bump GMSL version to pull in working Event.Redact * Remove logging * Make redactions work on v3+ * Fix more tests
Diffstat (limited to 'roomserver/api')
-rw-r--r--roomserver/api/output.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/roomserver/api/output.go b/roomserver/api/output.go
index b25353ae..d6c09f9e 100644
--- a/roomserver/api/output.go
+++ b/roomserver/api/output.go
@@ -29,6 +29,22 @@ const (
// OutputTypeRetireInviteEvent indicates that the event is an OutputRetireInviteEvent
OutputTypeRetireInviteEvent OutputType = "retire_invite_event"
// OutputTypeRedactedEvent indicates that the event is an OutputRedactedEvent
+ //
+ // This event is emitted when a redaction has been 'validated' (meaning both the redaction and the event to redact are known).
+ // Redaction validation happens when the roomserver receives either:
+ // - A redaction for which we have the event to redact.
+ // - Any event for which we have a redaction.
+ // When the roomserver receives an event, it will check against the redactions table to see if there is a matching redaction
+ // for the event. If there is, it will mark the redaction as validated and emit this event. In the common case of a redaction
+ // happening after receiving the event to redact, the roomserver will emit a OutputTypeNewRoomEvent of m.room.redaction
+ // immediately followed by a OutputTypeRedactedEvent. In the uncommon case of receiving the redaction BEFORE the event to redact,
+ // the roomserver will emit a OutputTypeNewRoomEvent of the event to redact immediately followed by a OutputTypeRedactedEvent.
+ //
+ // In order to honour redactions correctly, downstream components must ignore m.room.redaction events emitted via OutputTypeNewRoomEvent.
+ // When downstream components receive an OutputTypeRedactedEvent they must:
+ // - Pull out the event to redact from the database. They should have this because the redaction is validated.
+ // - Redact the event and set the corresponding `unsigned` fields to indicate it as redacted.
+ // - Replace the event in the database.
OutputTypeRedactedEvent OutputType = "redacted_event"
)