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
fix: user patch with empty email (#578)
boojackb511a7b634e9
diff --git a/server/user.go b/server/user.goindex e32a4289a..0927091a8 100644--- a/server/user.go+++ b/server/user.go@@ -199,7 +199,7 @@ func (s *Server) registerUserRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch user request").SetInternal(err)}- if userPatch.Email != nil && !common.ValidateEmail(*userPatch.Email) {+ if userPatch.Email != nil && *userPatch.Email != "" && !common.ValidateEmail(*userPatch.Email) {return echo.NewHTTPError(http.StatusBadRequest, "Invalid email format")}diff --git a/web/src/components/UpdateAccountDialog.tsx b/web/src/components/UpdateAccountDialog.tsxindex 4f124b355..a7c29132c 100644--- a/web/src/components/UpdateAccountDialog.tsx+++ b/web/src/components/UpdateAccountDialog.tsx@@ -1,3 +1,4 @@+import { isEqual } from "lodash";import { useEffect, useState } from "react";import { useTranslation } from "react-i18next";import { useAppSelector } from "../store";@@ -64,12 +65,19 @@ const UpdateAccountDialog: React.FC<Props> = ({ destroy }: Props) => {try {const user = userService.getState().user as User;- await userService.patchUser({+ const userPatch: UserPatch = {id: user.id,- username: state.username,- nickname: state.nickname,- email: state.email,- });+ };+ if (!isEqual(user.nickname, state.nickname)) {+ userPatch.nickname = state.nickname;+ }+ if (!isEqual(user.username, state.username)) {+ userPatch.username = state.username;+ }+ if (!isEqual(user.email, state.email)) {+ userPatch.email = state.email;+ }+ await userService.patchUser(userPatch);toastHelper.info("Update succeed");handleCloseBtnClick();} catch (error: any) {diff --git a/web/src/components/UserBanner.tsx b/web/src/components/UserBanner.tsxindex 6b6a92855..833a95485 100644--- a/web/src/components/UserBanner.tsx+++ b/web/src/components/UserBanner.tsx@@ -76,7 +76,7 @@ const UserBanner = () => {</div><Dropdowntrigger={<Icon.MoreHorizontal className="ml-2 w-5 h-auto cursor-pointer" />}- actionsClassName="!w-36"+ actionsClassName="min-w-36"actions={<>{!userService.isVisitorMode() && (