mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-29 12:42:46 +00:00
Implement local redaction (#1182)
* Create redaction events and apply checks (but do not send them) * Send redactions to the roomserver * Linting * Slightly better wording
This commit is contained in:
parent
46dbc46f84
commit
ea9df46c70
11 changed files with 206 additions and 30 deletions
|
@ -18,6 +18,7 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/matrix-org/util"
|
||||
)
|
||||
|
||||
// SendEvents to the roomserver The events are written with KindNew.
|
||||
|
@ -115,3 +116,19 @@ func SendInvite(
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetEvent returns the event or nil, even on errors.
|
||||
func GetEvent(ctx context.Context, rsAPI RoomserverInternalAPI, eventID string) *gomatrixserverlib.HeaderedEvent {
|
||||
var res QueryEventsByIDResponse
|
||||
err := rsAPI.QueryEventsByID(ctx, &QueryEventsByIDRequest{
|
||||
EventIDs: []string{eventID},
|
||||
}, &res)
|
||||
if err != nil {
|
||||
util.GetLogger(ctx).WithError(err).Error("Failed to QueryEventsByID")
|
||||
return nil
|
||||
}
|
||||
if len(res.Events) != 1 {
|
||||
return nil
|
||||
}
|
||||
return &res.Events[0]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue