mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-13 21:02:25 +03:00
PDU Sender split (#3100)
Initial cut of splitting PDU Sender into SenderID & looking up UserID where required.
This commit is contained in:
parent
725ff5567d
commit
7a1fd7f512
66 changed files with 580 additions and 189 deletions
|
@ -2,6 +2,7 @@ package routing
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
@ -9,6 +10,7 @@ import (
|
|||
|
||||
"github.com/matrix-org/dendrite/internal/fulltext"
|
||||
"github.com/matrix-org/dendrite/internal/sqlutil"
|
||||
rsapi "github.com/matrix-org/dendrite/roomserver/api"
|
||||
rstypes "github.com/matrix-org/dendrite/roomserver/types"
|
||||
"github.com/matrix-org/dendrite/syncapi/storage"
|
||||
"github.com/matrix-org/dendrite/syncapi/synctypes"
|
||||
|
@ -21,6 +23,12 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
type FakeSyncRoomserverAPI struct{ rsapi.SyncRoomserverAPI }
|
||||
|
||||
func (f *FakeSyncRoomserverAPI) QueryUserIDForSender(ctx context.Context, roomID string, senderID string) (*spec.UserID, error) {
|
||||
return spec.NewUserID(senderID, true)
|
||||
}
|
||||
|
||||
func TestSearch(t *testing.T) {
|
||||
alice := test.NewUser(t)
|
||||
aliceDevice := userapi.Device{UserID: alice.ID}
|
||||
|
@ -247,7 +255,7 @@ func TestSearch(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
req := httptest.NewRequest(http.MethodPost, "/", reqBody)
|
||||
|
||||
res := Search(req, tc.device, db, fts, tc.from)
|
||||
res := Search(req, tc.device, db, fts, tc.from, &FakeSyncRoomserverAPI{})
|
||||
if !tc.wantOK && !res.Is2xx() {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue