mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-11 17:03:10 -06:00
Applied requested changes
This commit is contained in:
parent
0dd83746d1
commit
54bc5129ff
|
|
@ -42,10 +42,14 @@ type displayName struct {
|
||||||
func GetProfile(
|
func GetProfile(
|
||||||
req *http.Request, accountDB *accounts.Database, userID string,
|
req *http.Request, accountDB *accounts.Database, userID string,
|
||||||
) util.JSONResponse {
|
) util.JSONResponse {
|
||||||
if req.Method == "GET" {
|
if req.Method != "GET" {
|
||||||
|
return util.JSONResponse{
|
||||||
|
Code: 405,
|
||||||
|
JSON: jsonerror.NotFound("Bad method"),
|
||||||
|
}
|
||||||
|
}
|
||||||
localpart := getLocalPart(userID)
|
localpart := getLocalPart(userID)
|
||||||
profile, err := accountDB.GetProfileByLocalpart(localpart)
|
if profile, err := accountDB.GetProfileByLocalpart(localpart); err == nil {
|
||||||
if err == nil {
|
|
||||||
res := profileResponse{
|
res := profileResponse{
|
||||||
AvatarURL: profile.AvatarURL,
|
AvatarURL: profile.AvatarURL,
|
||||||
DisplayName: profile.DisplayName,
|
DisplayName: profile.DisplayName,
|
||||||
|
|
@ -59,11 +63,6 @@ func GetProfile(
|
||||||
Code: 500,
|
Code: 500,
|
||||||
JSON: jsonerror.Unknown("Failed to load user profile"),
|
JSON: jsonerror.Unknown("Failed to load user profile"),
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return util.JSONResponse{
|
|
||||||
Code: 405,
|
|
||||||
JSON: jsonerror.NotFound("Bad method"),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AvatarURL implements GET and PUT /profile/{userID}/avatar_url
|
// AvatarURL implements GET and PUT /profile/{userID}/avatar_url
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue