mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22: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
|
@ -7,6 +7,24 @@ import (
|
|||
"github.com/matrix-org/util"
|
||||
)
|
||||
|
||||
// GetEvent returns the current state event in the room or nil.
|
||||
func GetEvent(ctx context.Context, stateAPI CurrentStateInternalAPI, roomID string, tuple gomatrixserverlib.StateKeyTuple) *gomatrixserverlib.HeaderedEvent {
|
||||
var res QueryCurrentStateResponse
|
||||
err := stateAPI.QueryCurrentState(ctx, &QueryCurrentStateRequest{
|
||||
RoomID: roomID,
|
||||
StateTuples: []gomatrixserverlib.StateKeyTuple{tuple},
|
||||
}, &res)
|
||||
if err != nil {
|
||||
util.GetLogger(ctx).WithError(err).Error("Failed to QueryCurrentState")
|
||||
return nil
|
||||
}
|
||||
ev, ok := res.StateEvents[tuple]
|
||||
if ok {
|
||||
return ev
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// PopulatePublicRooms extracts PublicRoom information for all the provided room IDs. The IDs are not checked to see if they are visible in the
|
||||
// published room directory.
|
||||
// due to lots of switches
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue