diff --git a/.changeset/many-carrots-care.md b/.changeset/many-carrots-care.md new file mode 100644 index 000000000000..cfc61b1645d7 --- /dev/null +++ b/.changeset/many-carrots-care.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': major +--- + +Removes the deprecated method `livechat:saveAppearance`. Moving forward use the endpoint `livechat/appearance`. diff --git a/apps/meteor/app/livechat/server/index.ts b/apps/meteor/app/livechat/server/index.ts index d365b8af5a1b..33aee906e47a 100644 --- a/apps/meteor/app/livechat/server/index.ts +++ b/apps/meteor/app/livechat/server/index.ts @@ -35,7 +35,6 @@ import './methods/removeManager'; import './methods/removeTrigger'; import './methods/removeRoom'; import './methods/saveAgentInfo'; -import './methods/saveAppearance'; import './methods/saveCustomField'; import './methods/saveDepartment'; import './methods/saveDepartmentAgents'; diff --git a/apps/meteor/app/livechat/server/methods/saveAppearance.ts b/apps/meteor/app/livechat/server/methods/saveAppearance.ts deleted file mode 100644 index 619dae147708..000000000000 --- a/apps/meteor/app/livechat/server/methods/saveAppearance.ts +++ /dev/null @@ -1,63 +0,0 @@ -import type { ServerMethods } from '@rocket.chat/ddp-client'; -import { Settings } from '@rocket.chat/models'; -import { Meteor } from 'meteor/meteor'; - -import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission'; -import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger'; -import { notifyOnSettingChangedById } from '../../../lib/server/lib/notifyListener'; - -declare module '@rocket.chat/ddp-client' { - // eslint-disable-next-line @typescript-eslint/naming-convention - interface ServerMethods { - 'livechat:saveAppearance'(settings: { _id: string; value: any }[]): Promise; - } -} - -Meteor.methods({ - async 'livechat:saveAppearance'(settings) { - methodDeprecationLogger.method('livechat:saveAppearance', '7.0.0'); - - const uid = Meteor.userId(); - if (!uid || !(await hasPermissionAsync(uid, 'view-livechat-manager'))) { - throw new Meteor.Error('error-not-allowed', 'Not allowed', { - method: 'livechat:saveAppearance', - }); - } - - const validSettings = [ - 'Livechat_title', - 'Livechat_title_color', - 'Livechat_enable_message_character_limit', - 'Livechat_message_character_limit', - 'Livechat_show_agent_info', - 'Livechat_show_agent_email', - 'Livechat_display_offline_form', - 'Livechat_offline_form_unavailable', - 'Livechat_offline_message', - 'Livechat_offline_success_message', - 'Livechat_offline_title', - 'Livechat_offline_title_color', - 'Livechat_offline_email', - 'Livechat_conversation_finished_message', - 'Livechat_conversation_finished_text', - 'Livechat_registration_form', - 'Livechat_name_field_registration_form', - 'Livechat_email_field_registration_form', - 'Livechat_registration_form_message', - ]; - - const valid = settings.every((setting) => validSettings.indexOf(setting._id) !== -1); - - if (!valid) { - throw new Meteor.Error('invalid-setting'); - } - - const promises = settings.map((setting) => Settings.updateValueById(setting._id, setting.value)); - - (await Promise.all(promises)).forEach((value, index) => { - if (value?.modifiedCount) { - void notifyOnSettingChangedById(settings[index]._id); - } - }); - }, -});