Removed useless checks

This commit is contained in:
Brendan Abolivier 2017-07-10 14:18:55 +01:00
parent eaa21e2a1d
commit 3a75686f4e
No known key found for this signature in database
GPG key ID: 8EF1500759F70623

View file

@ -67,12 +67,6 @@ func GetProfile(
func GetAvatarURL(
req *http.Request, accountDB *accounts.Database, userID string,
) util.JSONResponse {
if req.Method != "GET" {
return util.JSONResponse{
Code: 405,
JSON: jsonerror.NotFound("Bad method"),
}
}
localpart := getLocalPart(userID)
profile, err := accountDB.GetProfileByLocalpart(localpart)
if err != nil {
@ -91,12 +85,6 @@ func GetAvatarURL(
func SetAvatarURL(
req *http.Request, accountDB *accounts.Database, userID string,
) util.JSONResponse {
if req.Method != "PUT" {
return util.JSONResponse{
Code: 405,
JSON: jsonerror.NotFound("Bad method"),
}
}
var r avatarURL
if resErr := httputil.UnmarshalJSONRequest(req, &r); resErr != nil {
return *resErr
@ -122,12 +110,6 @@ func SetAvatarURL(
func GetDisplayName(
req *http.Request, accountDB *accounts.Database, userID string,
) util.JSONResponse {
if req.Method != "GET" {
return util.JSONResponse{
Code: 405,
JSON: jsonerror.NotFound("Bad method"),
}
}
localpart := getLocalPart(userID)
profile, err := accountDB.GetProfileByLocalpart(localpart)
if err != nil {
@ -146,12 +128,6 @@ func GetDisplayName(
func SetDisplayName(
req *http.Request, accountDB *accounts.Database, userID string,
) util.JSONResponse {
if req.Method != "PUT" {
return util.JSONResponse{
Code: 405,
JSON: jsonerror.NotFound("Bad method"),
}
}
var r displayName
if resErr := httputil.UnmarshalJSONRequest(req, &r); resErr != nil {
return *resErr