Move Invite logic to GMSL (#3086)

This is both the federation receiving & sending side logic (which were
previously entangeld in a single function)
This commit is contained in:
devonh 2023-05-31 16:33:49 +00:00 committed by GitHub
parent cbdc601f1b
commit ea6b368ad4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 359 additions and 442 deletions

View file

@ -152,8 +152,16 @@ func Setup(
JSON: spec.Forbidden("Forbidden by server ACLs"),
}
}
roomID, err := spec.NewRoomID(vars["roomID"])
if err != nil {
return util.JSONResponse{
Code: http.StatusBadRequest,
JSON: spec.InvalidParam("Invalid RoomID"),
}
}
return InviteV1(
httpReq, request, vars["roomID"], vars["eventID"],
httpReq, request, *roomID, vars["eventID"],
cfg, rsAPI, keys,
)
},
@ -168,8 +176,16 @@ func Setup(
JSON: spec.Forbidden("Forbidden by server ACLs"),
}
}
roomID, err := spec.NewRoomID(vars["roomID"])
if err != nil {
return util.JSONResponse{
Code: http.StatusBadRequest,
JSON: spec.InvalidParam("Invalid RoomID"),
}
}
return InviteV2(
httpReq, request, vars["roomID"], vars["eventID"],
httpReq, request, *roomID, vars["eventID"],
cfg, rsAPI, keys,
)
},