( req *http.Request, profileAPI userapi.ClientUserAPI, device *userapi.Device, roomID string, cfg *config.ClientAPI, rsAPI roomserverAPI.ClientRoomserverAPI, asAPI appserviceAPI.AppServiceInternalAPI, )
| 206 | } |
| 207 | |
| 208 | func SendInvite( |
| 209 | req *http.Request, profileAPI userapi.ClientUserAPI, device *userapi.Device, |
| 210 | roomID string, cfg *config.ClientAPI, |
| 211 | rsAPI roomserverAPI.ClientRoomserverAPI, asAPI appserviceAPI.AppServiceInternalAPI, |
| 212 | ) util.JSONResponse { |
| 213 | body, evTime, _, reqErr := extractRequestData(req, roomID, rsAPI) |
| 214 | if reqErr != nil { |
| 215 | return *reqErr |
| 216 | } |
| 217 | |
| 218 | inviteStored, jsonErrResp := checkAndProcessThreepid( |
| 219 | req, device, body, cfg, rsAPI, profileAPI, roomID, evTime, |
| 220 | ) |
| 221 | if jsonErrResp != nil { |
| 222 | return *jsonErrResp |
| 223 | } |
| 224 | |
| 225 | // If an invite has been stored on an identity server, it means that a |
| 226 | // m.room.third_party_invite event has been emitted and that we shouldn't |
| 227 | // emit a m.room.member one. |
| 228 | if inviteStored { |
| 229 | return util.JSONResponse{ |
| 230 | Code: http.StatusOK, |
| 231 | JSON: struct{}{}, |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | // We already received the return value, so no need to check for an error here. |
| 236 | response, _ := sendInvite(req.Context(), profileAPI, device, roomID, body.UserID, body.Reason, cfg, rsAPI, asAPI, evTime) |
| 237 | return response |
| 238 | } |
| 239 | |
| 240 | // sendInvite sends an invitation to a user. Returns a JSONResponse and an error |
| 241 | func sendInvite( |
no test coverage detected