mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 10:33:11 -06:00
Handle redactions
This commit is contained in:
parent
ff786c0094
commit
c9ef9a6106
|
|
@ -597,10 +597,18 @@ func (d *Database) UpdateRelations(ctx context.Context, event *gomatrixserverlib
|
|||
return nil
|
||||
}
|
||||
return d.Writer.Do(d.DB, nil, func(txn *sql.Tx) error {
|
||||
_, err := d.Relations.InsertRelation(
|
||||
ctx, txn, event.RoomID(), content.Relations.EventID,
|
||||
event.EventID(), content.Relations.RelationType,
|
||||
)
|
||||
var err error
|
||||
if event.Redacted() {
|
||||
err = d.Relations.DeleteRelation(
|
||||
ctx, txn, event.RoomID(), content.Relations.EventID,
|
||||
event.EventID(), content.Relations.RelationType,
|
||||
)
|
||||
} else {
|
||||
_, err = d.Relations.InsertRelation(
|
||||
ctx, txn, event.RoomID(), content.Relations.EventID,
|
||||
event.EventID(), content.Relations.RelationType,
|
||||
)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue