From 4b189dc8de080c7aa2f43bb103a40364520f3ed4 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Tue, 21 Nov 2023 14:33:07 -0300 Subject: [PATCH] review --- apps/meteor/app/lib/server/methods/saveSettings.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/meteor/app/lib/server/methods/saveSettings.ts b/apps/meteor/app/lib/server/methods/saveSettings.ts index e08375e3aa9..6d7c0927c3f 100644 --- a/apps/meteor/app/lib/server/methods/saveSettings.ts +++ b/apps/meteor/app/lib/server/methods/saveSettings.ts @@ -8,6 +8,7 @@ import { Meteor } from 'meteor/meteor'; import { twoFactorRequired } from '../../../2fa/server/twoFactorRequired'; import { getSettingPermissionId } from '../../../authorization/lib'; import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission'; +import { settings } from '../../../settings/server'; declare module '@rocket.chat/ui-contexts' { // eslint-disable-next-line @typescript-eslint/naming-convention @@ -52,10 +53,15 @@ Meteor.methods({ const orgName = params.find(({ _id }) => _id === 'Organization_Name'); if (orgName) { - params.push({ - _id: 'Site_Name', - value: orgName.value, - }); + // check if the site name is still the default value or ifs the same as organization name + const siteName = await Settings.findOneById('Site_Name'); + + if (siteName?.value === siteName?.packageValue || siteName?.value === settings.get('Organization_Name')) { + params.push({ + _id: 'Site_Name', + value: orgName.value, + }); + } } await Promise.all(