From c92be6e92e783b952f26bfd956f7358f96d37a27 Mon Sep 17 00:00:00 2001 From: Matt Gabrenya Date: Thu, 26 May 2022 14:03:58 -0400 Subject: [PATCH 1/2] 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}

+
+ )}
From 91efbae8f8a762a0318f5649216aac3e2dd77c74 Mon Sep 17 00:00:00 2001 From: Matt Gabrenya Date: Thu, 26 May 2022 14:10:52 -0400 Subject: [PATCH 2/2] test(api): increase time for tests to prepare --- packages/api/src/tests/setup.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/api/src/tests/setup.ts b/packages/api/src/tests/setup.ts index 0b4867131..807f26a5b 100644 --- a/packages/api/src/tests/setup.ts +++ b/packages/api/src/tests/setup.ts @@ -12,7 +12,7 @@ const mochaHooks = async (): Promise => { return Promise.resolve({ async beforeAll(this: TestContext): Promise { // extend timeout to allow for long database migrations / application setup - this.timeout(20000); + this.timeout(30000); this.app = await setup(); logger.info('Running api tests:\n\n');