loadProfile lookups the profile of a given user from the database and returns it if the user is local to this server, or returns an empty profile if not. Returns an error if the retrieval failed or if the first parameter isn't a valid Matrix ID.
( ctx context.Context, userID string, cfg *config.ClientAPI, profileAPI userapi.ClientUserAPI, asAPI appserviceAPI.AppServiceInternalAPI, )
| 329 | // Returns an error if the retrieval failed or if the first parameter isn't a |
| 330 | // valid Matrix ID. |
| 331 | func loadProfile( |
| 332 | ctx context.Context, |
| 333 | userID string, |
| 334 | cfg *config.ClientAPI, |
| 335 | profileAPI userapi.ClientUserAPI, |
| 336 | asAPI appserviceAPI.AppServiceInternalAPI, |
| 337 | ) (*authtypes.Profile, error) { |
| 338 | _, serverName, err := gomatrixserverlib.SplitID('@', userID) |
| 339 | if err != nil { |
| 340 | return nil, err |
| 341 | } |
| 342 | |
| 343 | var profile *authtypes.Profile |
| 344 | if serverName == cfg.Matrix.ServerName { |
| 345 | profile, err = appserviceAPI.RetrieveUserProfile(ctx, userID, asAPI, profileAPI) |
| 346 | } else { |
| 347 | profile = &authtypes.Profile{} |
| 348 | } |
| 349 | |
| 350 | return profile, err |
| 351 | } |
| 352 | |
| 353 | func extractRequestData(req *http.Request, roomID string, rsAPI roomserverAPI.ClientRoomserverAPI) ( |
| 354 | body *threepid.MembershipRequest, evTime time.Time, roomVer gomatrixserverlib.RoomVersion, resErr *util.JSONResponse, |
no outgoing calls
no test coverage detected