Fix avatar and display name update issues
- Remove avatar handling from profile update to prevent overwriting DB with display URL - Skip ensureParent for .avatars to speed up upload - Add change detection for display name save button - Update API client to not send avatarUrl in profile update
This commit is contained in:
@@ -3872,7 +3872,6 @@ func updateUserProfileHandler(w http.ResponseWriter, r *http.Request, db *databa
|
||||
var req struct {
|
||||
DisplayName *string `json:"displayName"`
|
||||
Email *string `json:"email"`
|
||||
AvatarURL *string `json:"avatarUrl"`
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(r.Body).Decode(&req); err != nil {
|
||||
@@ -3895,11 +3894,6 @@ func updateUserProfileHandler(w http.ResponseWriter, r *http.Request, db *databa
|
||||
args = append(args, *req.Email)
|
||||
argIndex++
|
||||
}
|
||||
if req.AvatarURL != nil {
|
||||
setParts = append(setParts, fmt.Sprintf("avatar_url = $%d", argIndex))
|
||||
args = append(args, *req.AvatarURL)
|
||||
argIndex++
|
||||
}
|
||||
|
||||
if len(setParts) == 0 {
|
||||
// No fields to update
|
||||
@@ -3927,9 +3921,6 @@ func updateUserProfileHandler(w http.ResponseWriter, r *http.Request, db *databa
|
||||
if req.Email != nil {
|
||||
metadata["email"] = *req.Email
|
||||
}
|
||||
if req.AvatarURL != nil {
|
||||
metadata["avatarUrl"] = *req.AvatarURL
|
||||
}
|
||||
|
||||
auditLogger.Log(r.Context(), audit.Entry{
|
||||
UserID: &userID,
|
||||
|
||||
Reference in New Issue
Block a user