Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

fix user update patch null checker

steven1edf40ef69c3
diff --git a/api/user.go b/api/user.go
index f1032aea8..1018ebd29 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{