From beec5663fd9a2fcf1f6777592fb2f38eef22eb24 Mon Sep 17 00:00:00 2001 From: Pierre Lehnen <55164754+pierre-lehnen-rc@users.noreply.github.com> Date: Wed, 12 Feb 2025 18:59:14 -0300 Subject: [PATCH] fix: empty "Apps_Error_" toast message when private app installation fails (#35189) --- .changeset/brave-ties-shout.md | 6 ++++++ apps/meteor/ee/server/apps/communication/rest.ts | 5 +++-- packages/i18n/src/locales/en.i18n.json | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 .changeset/brave-ties-shout.md diff --git a/.changeset/brave-ties-shout.md b/.changeset/brave-ties-shout.md new file mode 100644 index 00000000000..808c3abc463 --- /dev/null +++ b/.changeset/brave-ties-shout.md @@ -0,0 +1,6 @@ +--- +'@rocket.chat/i18n': patch +'@rocket.chat/meteor': patch +--- + +fixes toast with empty error messages when a private app installation fails diff --git a/apps/meteor/ee/server/apps/communication/rest.ts b/apps/meteor/ee/server/apps/communication/rest.ts index 7e1ecdef987..28f404fe5cc 100644 --- a/apps/meteor/ee/server/apps/communication/rest.ts +++ b/apps/meteor/ee/server/apps/communication/rest.ts @@ -383,7 +383,7 @@ export class AppsRestApi { } if (!buff) { - return API.v1.failure({ error: 'Failed to get a file to install for the App. ' }); + return API.v1.failure({ error: 'app_file_error', message: 'Failed to get a file to install for the App. ' }); } // Used mostly in Cloud hosting for security reasons @@ -400,11 +400,12 @@ export class AppsRestApi { const info: IAppInfo & { status?: AppStatus } = aff.getAppInfo(); if (aff.hasStorageError()) { - return API.v1.failure({ status: 'storage_error', messages: [aff.getStorageError()] }); + return API.v1.failure({ error: 'app_storage_error', status: 'storage_error', messages: [aff.getStorageError()] }); } if (aff.hasAppUserError()) { return API.v1.failure({ + error: 'app_user_error', status: 'app_user_error', messages: [(aff.getAppUserError() as Record).message], payload: { username: (aff.getAppUserError() as Record).username }, diff --git a/packages/i18n/src/locales/en.i18n.json b/packages/i18n/src/locales/en.i18n.json index 61b2ba1c4fd..9389f841f22 100644 --- a/packages/i18n/src/locales/en.i18n.json +++ b/packages/i18n/src/locales/en.i18n.json @@ -591,6 +591,10 @@ "Apps_disabled_when_Premium_trial_ended_description_admin": "Community workspaces can enable up to 5 marketplace apps. Private apps can only be enabled in premium plans. Reenable the apps you require.", "Apps_Engine_Version": "Apps Engine Version", "Apps_Error_private_app_install_disabled": "Private app installation and updates are disabled in this workspace", + "Apps_Error_": "Unknown app error.", + "Apps_Error_app_file_error": "Failed to get a file to install for the App.", + "Apps_Error_app_storage_error": "Failed to save app file on storage.", + "Apps_Error_app_user_error": "Failed to create app user.", "Apps_Essential_Alert": "This app is essential for the following events:", "Apps_Essential_Disclaimer": "Events listed above will be disrupted if this app is disabled. If you want Rocket.Chat to work without this app's functionality, you need to uninstall it", "Apps_Framework_Source_Package_Storage_Type": "Apps' Source Package Storage type",