Remove senderID input from perform join

This commit is contained in:
Devon Hudson 2023-06-14 14:15:54 +01:00
parent 29cd66fd23
commit 9c0f7b7dd2
No known key found for this signature in database
GPG key ID: CD06B18E77F6A628
6 changed files with 11 additions and 17 deletions

View file

@ -159,7 +159,6 @@ type PerformDirectoryLookupResponse struct {
type PerformJoinRequest struct {
RoomID string `json:"room_id"`
UserID string `json:"user_id"`
SenderID spec.SenderID
// The sorted list of servers to try. Servers will be tried sequentially, after de-duplication.
ServerNames types.ServerNames `json:"server_names"`
Content map[string]interface{} `json:"content"`

View file

@ -235,7 +235,6 @@ func testFederationAPIJoinThenKeyUpdate(t *testing.T, dbType test.DBType) {
fsapi.PerformJoin(context.Background(), &api.PerformJoinRequest{
RoomID: room.ID,
UserID: joiningUser.ID,
SenderID: spec.SenderID(joiningUser.ID),
ServerNames: []spec.ServerName{serverA},
}, &resp)
if resp.JoinedVia != serverA {

View file

@ -96,7 +96,6 @@ func (r *FederationInternalAPI) PerformJoin(
ctx,
request.RoomID,
request.UserID,
request.SenderID,
request.Content,
serverName,
request.Unsigned,
@ -138,7 +137,7 @@ func (r *FederationInternalAPI) PerformJoin(
func (r *FederationInternalAPI) performJoinUsingServer(
ctx context.Context,
roomID, userID string, senderID spec.SenderID,
roomID, userID string,
content map[string]interface{},
serverName spec.ServerName,
unsigned map[string]interface{},
@ -158,7 +157,6 @@ func (r *FederationInternalAPI) performJoinUsingServer(
joinInput := gomatrixserverlib.PerformJoinInput{
UserID: user,
SenderID: senderID,
RoomID: room,
ServerName: serverName,
Content: content,

2
go.mod
View file

@ -22,7 +22,7 @@ require (
github.com/matrix-org/dugong v0.0.0-20210921133753-66e6b1c67e2e
github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530
github.com/matrix-org/gomatrixserverlib v0.0.0-20230614105257-ddcf62d19d7e
github.com/matrix-org/gomatrixserverlib v0.0.0-20230614131217-2d6e6fab7500
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a
github.com/matrix-org/util v0.0.0-20221111132719-399730281e66
github.com/mattn/go-sqlite3 v1.14.16

4
go.sum
View file

@ -323,8 +323,8 @@ github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91 h1:s7fexw
github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91/go.mod h1:e+cg2q7C7yE5QnAXgzo512tgFh1RbQLC0+jozuegKgo=
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530 h1:kHKxCOLcHH8r4Fzarl4+Y3K5hjothkVW5z7T1dUM11U=
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530/go.mod h1:/gBX06Kw0exX1HrwmoBibFA98yBk/jxKpGVeyQbff+s=
github.com/matrix-org/gomatrixserverlib v0.0.0-20230614105257-ddcf62d19d7e h1:oxhV2yDP21/PddckGoA9paBZAN/bceccYXexcSi0EBg=
github.com/matrix-org/gomatrixserverlib v0.0.0-20230614105257-ddcf62d19d7e/go.mod h1:H9V9N3Uqn1bBJqYJNGK1noqtgJTaCEhtTdcH/mp50uU=
github.com/matrix-org/gomatrixserverlib v0.0.0-20230614131217-2d6e6fab7500 h1:/HrUyJl02nguDKl5VDpOpwkWuDHt3L+dc4TQNWFCr0E=
github.com/matrix-org/gomatrixserverlib v0.0.0-20230614131217-2d6e6fab7500/go.mod h1:H9V9N3Uqn1bBJqYJNGK1noqtgJTaCEhtTdcH/mp50uU=
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a h1:awrPDf9LEFySxTLKYBMCiObelNx/cBuv/wzllvCCH3A=
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a/go.mod h1:HchJX9oKMXaT2xYFs0Ha/6Zs06mxLU8k6F1ODnrGkeQ=
github.com/matrix-org/util v0.0.0-20221111132719-399730281e66 h1:6z4KxomXSIGWqhHcfzExgkH3Z3UkIXry4ibJS4Aqz2Y=

View file

@ -272,7 +272,7 @@ func (r *Joiner) performJoinRoomByID(
var joinedVia spec.ServerName
if forceFederatedJoin {
// TODO : pseudoIDs - pass through userID here since we don't know what the senderID should be yet
joinedVia, err = r.performFederatedJoinRoomByID(ctx, req, senderID)
joinedVia, err = r.performFederatedJoinRoomByID(ctx, req)
return req.RoomIDOrAlias, joinedVia, err
}
@ -362,7 +362,7 @@ func (r *Joiner) performJoinRoomByID(
}
// Perform a federated room join.
joinedVia, err = r.performFederatedJoinRoomByID(ctx, req, senderID)
joinedVia, err = r.performFederatedJoinRoomByID(ctx, req)
return req.RoomIDOrAlias, joinedVia, err
default:
@ -380,13 +380,11 @@ func (r *Joiner) performJoinRoomByID(
func (r *Joiner) performFederatedJoinRoomByID(
ctx context.Context,
req *rsAPI.PerformJoinRequest,
senderID spec.SenderID,
) (spec.ServerName, error) {
// Try joining by all of the supplied server names.
fedReq := fsAPI.PerformJoinRequest{
RoomID: req.RoomIDOrAlias, // the room ID to try and join
UserID: req.UserID, // the user ID joining the room
SenderID: spec.SenderID(senderID),
ServerNames: req.ServerNames, // the server to try joining with
Content: req.Content, // the membership event content
Unsigned: req.Unsigned, // the unsigned event content, if any