From c92be6e92e783b952f26bfd956f7358f96d37a27 Mon Sep 17 00:00:00 2001 From: Matt Gabrenya Date: Thu, 26 May 2022 14:03:58 -0400 Subject: [PATCH] fix: migration to revert removal of NAME setting --- .../11_settings_revert_drop_app_name.ts | 25 +++++++++++++++++++ .../src/layouts/AuthenticatedLayout.tsx | 9 ++++--- 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 packages/api/src/database/migrations/11_settings_revert_drop_app_name.ts diff --git a/packages/api/src/database/migrations/11_settings_revert_drop_app_name.ts b/packages/api/src/database/migrations/11_settings_revert_drop_app_name.ts new file mode 100644 index 000000000..401b17229 --- /dev/null +++ b/packages/api/src/database/migrations/11_settings_revert_drop_app_name.ts @@ -0,0 +1,25 @@ +import { SettingGroup } from '@settings/types'; +import { SettingsModel } from '@settings/entities'; + +const deleteSettings = [ + { + key: 'NAME', + label: 'App Name', + description: null, + group: SettingGroup.APPLICATION, + value: 'Praise', + type: 'String', + }, +]; + +const up = async (): Promise => { + await SettingsModel.insertMany(deleteSettings); +}; + +const down = async (): Promise => { + const deleteSettingKeys = deleteSettings.map((s) => s.key); + + await SettingsModel.deleteMany({ key: { $in: deleteSettingKeys } }); +}; + +export { up, down }; diff --git a/packages/frontend/src/layouts/AuthenticatedLayout.tsx b/packages/frontend/src/layouts/AuthenticatedLayout.tsx index e8cd5978b..92d0bb60f 100644 --- a/packages/frontend/src/layouts/AuthenticatedLayout.tsx +++ b/packages/frontend/src/layouts/AuthenticatedLayout.tsx @@ -103,9 +103,12 @@ const AuthenticatedLayout = (): JSX.Element | null => { aria-hidden="true" /> -
-

{siteNameSetting?.value}

-
+ + {siteNameSetting && ( +
+

{siteNameSetting.value}

+
+ )}