From 6dd1fdc546fa521618a8875f9cb7fbf5db7fcc97 Mon Sep 17 00:00:00 2001
From: Sean Hatfield
Date: Thu, 27 Feb 2025 07:23:24 +0800
Subject: [PATCH] Add bio field to user (#3346)
* add bio to users table
* lint
* add bio field to edit user admin page
* fix bio saving on new user
* simplify updating localstorage user
* linting
---------
Co-authored-by: timothycarambat
---
.../UserMenu/AccountModal/index.jsx | 16 +++++++++-
.../pages/Admin/Users/NewUserModal/index.jsx | 15 ++++++++++
.../Users/UserRow/EditUserModal/index.jsx | 29 ++++++++++++++++++-
server/endpoints/system.js | 10 +++----
server/models/user.js | 9 ++++++
.../20250226005538_init/migration.sql | 2 ++
server/prisma/schema.prisma | 1 +
7 files changed, 74 insertions(+), 8 deletions(-)
create mode 100644 server/prisma/migrations/20250226005538_init/migration.sql
diff --git a/frontend/src/components/UserMenu/AccountModal/index.jsx b/frontend/src/components/UserMenu/AccountModal/index.jsx
index 9de86893..a77c5145 100644
--- a/frontend/src/components/UserMenu/AccountModal/index.jsx
+++ b/frontend/src/components/UserMenu/AccountModal/index.jsx
@@ -50,9 +50,9 @@ export default function AccountModal({ user, hideModal }) {
const { success, error } = await System.updateUser(data);
if (success) {
let storedUser = JSON.parse(localStorage.getItem(AUTH_USER));
-
if (storedUser) {
storedUser.username = data.username;
+ storedUser.bio = data.bio;
localStorage.setItem(AUTH_USER, JSON.stringify(storedUser));
}
showToast("Profile updated.", "success", { clear: true });
@@ -164,6 +164,20 @@ export default function AccountModal({ user, hideModal }) {
Password must be at least 8 characters long
+
+
+
+
diff --git a/frontend/src/pages/Admin/Users/NewUserModal/index.jsx b/frontend/src/pages/Admin/Users/NewUserModal/index.jsx
index 54dab87e..8b11c1a1 100644
--- a/frontend/src/pages/Admin/Users/NewUserModal/index.jsx
+++ b/frontend/src/pages/Admin/Users/NewUserModal/index.jsx
@@ -95,6 +95,21 @@ export default function NewUserModal({ closeModal }) {
Password must be at least 8 characters long