From 1edf40ef69c3e1f1058d59c9ee8b91ad1811d100 Mon Sep 17 00:00:00 2001 From: steven Date: Sun, 12 Dec 2021 15:21:17 +0800 Subject: [PATCH] fix user update patch null checker --- api/user.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/user.go b/api/user.go index f1032aea..1018ebd2 100644 --- a/api/user.go +++ b/api/user.go @@ -37,7 +37,7 @@ func handleUpdateMyUserInfo(w http.ResponseWriter, r *http.Request) { return } - if *userPatch.Username != "" { + if userPatch.Username != nil { usernameUsable, _ := store.CheckUsernameUsable(*userPatch.Username) if !usernameUsable { json.NewEncoder(w).Encode(Response{ @@ -49,7 +49,7 @@ func handleUpdateMyUserInfo(w http.ResponseWriter, r *http.Request) { } } - if *userPatch.GithubName != "" { + if userPatch.GithubName != nil { githubNameUsable, _ := store.CheckGithubNameUsable(*userPatch.GithubName) if !githubNameUsable { json.NewEncoder(w).Encode(Response{ @@ -61,7 +61,7 @@ func handleUpdateMyUserInfo(w http.ResponseWriter, r *http.Request) { } } - if *userPatch.WxOpenId != "" { + if userPatch.WxOpenId != nil { wxOpenIdUsable, _ := store.CheckWxOpenIdUsable(*userPatch.GithubName) if !wxOpenIdUsable { json.NewEncoder(w).Encode(Response{