mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-10 16:33:11 -06:00
Removed useless checks
This commit is contained in:
parent
eaa21e2a1d
commit
3a75686f4e
|
|
@ -67,12 +67,6 @@ func GetProfile(
|
||||||
func GetAvatarURL(
|
func GetAvatarURL(
|
||||||
req *http.Request, accountDB *accounts.Database, userID string,
|
req *http.Request, accountDB *accounts.Database, userID string,
|
||||||
) util.JSONResponse {
|
) util.JSONResponse {
|
||||||
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)
|
profile, err := accountDB.GetProfileByLocalpart(localpart)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -91,12 +85,6 @@ func GetAvatarURL(
|
||||||
func SetAvatarURL(
|
func SetAvatarURL(
|
||||||
req *http.Request, accountDB *accounts.Database, userID string,
|
req *http.Request, accountDB *accounts.Database, userID string,
|
||||||
) util.JSONResponse {
|
) util.JSONResponse {
|
||||||
if req.Method != "PUT" {
|
|
||||||
return util.JSONResponse{
|
|
||||||
Code: 405,
|
|
||||||
JSON: jsonerror.NotFound("Bad method"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var r avatarURL
|
var r avatarURL
|
||||||
if resErr := httputil.UnmarshalJSONRequest(req, &r); resErr != nil {
|
if resErr := httputil.UnmarshalJSONRequest(req, &r); resErr != nil {
|
||||||
return *resErr
|
return *resErr
|
||||||
|
|
@ -122,12 +110,6 @@ func SetAvatarURL(
|
||||||
func GetDisplayName(
|
func GetDisplayName(
|
||||||
req *http.Request, accountDB *accounts.Database, userID string,
|
req *http.Request, accountDB *accounts.Database, userID string,
|
||||||
) util.JSONResponse {
|
) util.JSONResponse {
|
||||||
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)
|
profile, err := accountDB.GetProfileByLocalpart(localpart)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -146,12 +128,6 @@ func GetDisplayName(
|
||||||
func SetDisplayName(
|
func SetDisplayName(
|
||||||
req *http.Request, accountDB *accounts.Database, userID string,
|
req *http.Request, accountDB *accounts.Database, userID string,
|
||||||
) util.JSONResponse {
|
) util.JSONResponse {
|
||||||
if req.Method != "PUT" {
|
|
||||||
return util.JSONResponse{
|
|
||||||
Code: 405,
|
|
||||||
JSON: jsonerror.NotFound("Bad method"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var r displayName
|
var r displayName
|
||||||
if resErr := httputil.UnmarshalJSONRequest(req, &r); resErr != nil {
|
if resErr := httputil.UnmarshalJSONRequest(req, &r); resErr != nil {
|
||||||
return *resErr
|
return *resErr
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue