mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-06 08:02:46 +00:00
Use SenderID Type (#3105)
This commit is contained in:
parent
7a1fd7f512
commit
8ea1a11105
60 changed files with 502 additions and 275 deletions
|
@ -140,22 +140,24 @@ func ExchangeThirdPartyInvite(
|
|||
}
|
||||
}
|
||||
|
||||
_, senderDomain, err := cfg.Matrix.SplitLocalID('@', proto.Sender)
|
||||
if err != nil {
|
||||
userID, err := rsAPI.QueryUserIDForSender(httpReq.Context(), roomID, spec.SenderID(proto.SenderID))
|
||||
if err != nil || userID == nil {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: spec.BadJSON("Invalid sender ID: " + err.Error()),
|
||||
JSON: spec.BadJSON("Invalid sender ID"),
|
||||
}
|
||||
}
|
||||
senderDomain := userID.Domain()
|
||||
|
||||
// Check that the state key is correct.
|
||||
_, targetDomain, err := gomatrixserverlib.SplitID('@', *proto.StateKey)
|
||||
if err != nil {
|
||||
targetUserID, err := rsAPI.QueryUserIDForSender(httpReq.Context(), roomID, spec.SenderID(*proto.StateKey))
|
||||
if err != nil || targetUserID == nil {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: spec.BadJSON("The event's state key isn't a Matrix user ID"),
|
||||
}
|
||||
}
|
||||
targetDomain := targetUserID.Domain()
|
||||
|
||||
// Check that the target user is from the requesting homeserver.
|
||||
if targetDomain != request.Origin() {
|
||||
|
@ -271,7 +273,7 @@ func createInviteFrom3PIDInvite(
|
|||
// Build the event
|
||||
proto := &gomatrixserverlib.ProtoEvent{
|
||||
Type: "m.room.member",
|
||||
Sender: inv.Sender,
|
||||
SenderID: inv.Sender,
|
||||
RoomID: inv.RoomID,
|
||||
StateKey: &inv.MXID,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue