mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 22:22:46 +00:00
Refactor StoreEvent
, add MaybeRedactEvent
, create an EventDatabase
(#2989)
This PR changes the following: - `StoreEvent` now only stores an event (and possibly prev event), instead of also doing redactions - Adds a `MaybeRedactEvent` (pulled out from `StoreEvent`), which should be called after storing events - a few other things
This commit is contained in:
parent
1aa70b0f56
commit
6c20f8f742
34 changed files with 488 additions and 420 deletions
|
@ -4,9 +4,10 @@ import (
|
|||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/matrix-org/dendrite/roomserver/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/matrix-org/dendrite/roomserver/types"
|
||||
|
||||
"github.com/matrix-org/dendrite/setup/base"
|
||||
|
||||
"github.com/matrix-org/dendrite/test"
|
||||
|
@ -38,9 +39,9 @@ func TestIsInvitePendingWithoutNID(t *testing.T) {
|
|||
var authNIDs []types.EventNID
|
||||
for _, x := range room.Events() {
|
||||
|
||||
roomNID, err := db.GetOrCreateRoomNID(context.Background(), x.Unwrap())
|
||||
roomInfo, err := db.GetOrCreateRoomInfo(context.Background(), x.Unwrap())
|
||||
assert.NoError(t, err)
|
||||
assert.Greater(t, roomNID, types.RoomNID(0))
|
||||
assert.NotNil(t, roomInfo)
|
||||
|
||||
eventTypeNID, err := db.GetOrCreateEventTypeNID(context.Background(), x.Type())
|
||||
assert.NoError(t, err)
|
||||
|
@ -49,7 +50,7 @@ func TestIsInvitePendingWithoutNID(t *testing.T) {
|
|||
eventStateKeyNID, err := db.GetOrCreateEventStateKeyNID(context.Background(), x.StateKey())
|
||||
assert.NoError(t, err)
|
||||
|
||||
evNID, _, _, _, err := db.StoreEvent(context.Background(), x.Event, roomNID, eventTypeNID, eventStateKeyNID, authNIDs, false)
|
||||
evNID, _, err := db.StoreEvent(context.Background(), x.Event, roomInfo, eventTypeNID, eventStateKeyNID, authNIDs, false)
|
||||
assert.NoError(t, err)
|
||||
authNIDs = append(authNIDs, evNID)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue