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.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: fix update user
Steven4da3c1d5e5e6
diff --git a/api/v2/user_service.go b/api/v2/user_service.goindex 47aec8053..80f1c7437 100644--- a/api/v2/user_service.go+++ b/api/v2/user_service.go@@ -103,9 +103,17 @@ func (s *APIV2Service) UpdateUser(ctx context.Context, request *apiv2pb.UpdateUsreturn nil, status.Errorf(codes.InvalidArgument, "update mask is empty")}+ user, err := s.Store.GetUser(ctx, &store.FindUser{Username: &username})+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to get user: %v", err)+ }+ if user == nil {+ return nil, status.Errorf(codes.NotFound, "user not found")+ }+currentTs := time.Now().Unix()update := &store.UpdateUser{- ID: currentUser.ID,+ ID: user.ID,UpdatedTs: ¤tTs,}for _, field := range request.UpdateMask.Paths {@@ -138,13 +146,13 @@ func (s *APIV2Service) UpdateUser(ctx context.Context, request *apiv2pb.UpdateUs}}- user, err := s.Store.UpdateUser(ctx, update)+ updatedUser, err := s.Store.UpdateUser(ctx, update)if err != nil {return nil, status.Errorf(codes.Internal, "failed to update user: %v", err)}response := &apiv2pb.UpdateUserResponse{- User: convertUserFromStore(user),+ User: convertUserFromStore(updatedUser),}return response, nil}