From 8a9699494fdeba0fc8f9de9c0d6ad3be528bf144 Mon Sep 17 00:00:00 2001 From: Harish Mohan Raj Date: Fri, 5 Apr 2024 14:34:12 +0530 Subject: [PATCH] Update the default chat name when a new team is created (#292) --- app/main.wasp | 1 + .../migration.sql | 2 ++ app/src/client/admin/components/Sidebar.tsx | 2 +- app/src/client/app/ChatPage.tsx | 11 +++++++++- app/src/client/app/layout/ChatLayout.tsx | 3 +++ app/src/client/components/ChatSidebar.tsx | 22 +++++++++++++++---- .../client/components/EditableChatName.tsx | 8 +++++-- app/src/client/tests/chatUtils.test.ts | 16 ++++++++++---- app/src/client/utils/chatUtils.ts | 21 +++++++++++++++--- app/src/server/actions.ts | 3 +++ 10 files changed, 74 insertions(+), 15 deletions(-) create mode 100644 app/migrations/20240404022012_add_column_to_store_chat_name_update_status/migration.sql diff --git a/app/main.wasp b/app/main.wasp index 795fc66..7ce6035 100644 --- a/app/main.wasp +++ b/app/main.wasp @@ -136,6 +136,7 @@ entity Chat {=psl user User? @relation(fields: [userId], references: [id]) userId Int? name String? @default("New chat") + isChatNameUpdated Boolean @default(false) conversations Conversation[] psl=} diff --git a/app/migrations/20240404022012_add_column_to_store_chat_name_update_status/migration.sql b/app/migrations/20240404022012_add_column_to_store_chat_name_update_status/migration.sql new file mode 100644 index 0000000..b8c71b9 --- /dev/null +++ b/app/migrations/20240404022012_add_column_to_store_chat_name_update_status/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "Chat" ADD COLUMN "isChatNameUpdated" BOOLEAN NOT NULL DEFAULT false; diff --git a/app/src/client/admin/components/Sidebar.tsx b/app/src/client/admin/components/Sidebar.tsx index 5991cbb..88e9102 100644 --- a/app/src/client/admin/components/Sidebar.tsx +++ b/app/src/client/admin/components/Sidebar.tsx @@ -58,7 +58,7 @@ const Sidebar = ({ sidebarOpen, setSidebarOpen }: SidebarProps) => { return (