From ce0986aca4569326dac118f97da1e8ca8559dae3 Mon Sep 17 00:00:00 2001 From: Abhinav Kumar Date: Fri, 4 Oct 2024 11:05:34 +0530 Subject: [PATCH 1/2] chore!: removed deprecated method livechat:getAnalyticsOverviewData Signed-off-by: Abhinav Kumar --- .changeset/forty-pants-roll.md | 5 +++ apps/meteor/app/livechat/server/index.ts | 1 - .../methods/getAnalyticsOverviewData.ts | 41 ------------------- 3 files changed, 5 insertions(+), 42 deletions(-) create mode 100644 .changeset/forty-pants-roll.md delete mode 100644 apps/meteor/app/livechat/server/methods/getAnalyticsOverviewData.ts diff --git a/.changeset/forty-pants-roll.md b/.changeset/forty-pants-roll.md new file mode 100644 index 0000000000000..c655f0427e8e7 --- /dev/null +++ b/.changeset/forty-pants-roll.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': major +--- + +Removed deprecated `livechat:getAnalyticsOverviewData` method. Moving forward use the `livechat/analytics/overview` endpoint. diff --git a/apps/meteor/app/livechat/server/index.ts b/apps/meteor/app/livechat/server/index.ts index 90064827e2c64..b21bc048c254f 100644 --- a/apps/meteor/app/livechat/server/index.ts +++ b/apps/meteor/app/livechat/server/index.ts @@ -21,7 +21,6 @@ import './methods/changeLivechatStatus'; import './methods/closeRoom'; import './methods/discardTranscript'; import './methods/getAnalyticsChartData'; -import './methods/getAnalyticsOverviewData'; import './methods/getNextAgent'; import './methods/getRoutingConfig'; import './methods/registerGuest'; diff --git a/apps/meteor/app/livechat/server/methods/getAnalyticsOverviewData.ts b/apps/meteor/app/livechat/server/methods/getAnalyticsOverviewData.ts deleted file mode 100644 index 9f56cfa570693..0000000000000 --- a/apps/meteor/app/livechat/server/methods/getAnalyticsOverviewData.ts +++ /dev/null @@ -1,41 +0,0 @@ -import type { AnalyticsOverviewDataResult } from '@rocket.chat/core-services'; -import { OmnichannelAnalytics } from '@rocket.chat/core-services'; -import type { ServerMethods } from '@rocket.chat/ddp-client'; -import { Users } from '@rocket.chat/models'; -import { Meteor } from 'meteor/meteor'; - -import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission'; -import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger'; -import { settings } from '../../../settings/server'; - -declare module '@rocket.chat/ddp-client' { - // eslint-disable-next-line @typescript-eslint/naming-convention - interface ServerMethods { - 'livechat:getAnalyticsOverviewData'(options: { analyticsOptions: { name: string } }): AnalyticsOverviewDataResult[] | void; - } -} - -Meteor.methods({ - async 'livechat:getAnalyticsOverviewData'(options) { - methodDeprecationLogger.method('livechat:getAnalyticsOverviewData', '7.0.0', ' Use "livechat/analytics/overview" instead.'); - const uid = Meteor.userId(); - if (!uid || !(await hasPermissionAsync(uid, 'view-livechat-manager'))) { - throw new Meteor.Error('error-not-allowed', 'Not allowed', { - method: 'livechat:getAnalyticsOverviewData', - }); - } - - if (!options.analyticsOptions?.name) { - return; - } - - const user = await Users.findOneById(uid, { projection: { _id: 1, utcOffset: 1, language: 1 } }); - const language = user?.language || settings.get('Language') || 'en'; - - return OmnichannelAnalytics.getAnalyticsOverviewData({ - ...options, - utcOffset: user?.utcOffset || 0, - language, - }); - }, -}); From 50e6b69ea5d922d5f2f10234d212efcfa88875de Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Mon, 7 Oct 2024 17:45:37 -0300 Subject: [PATCH 2/2] Update forty-pants-roll.md --- .changeset/forty-pants-roll.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/forty-pants-roll.md b/.changeset/forty-pants-roll.md index c655f0427e8e7..b8eb5424fab65 100644 --- a/.changeset/forty-pants-roll.md +++ b/.changeset/forty-pants-roll.md @@ -2,4 +2,4 @@ '@rocket.chat/meteor': major --- -Removed deprecated `livechat:getAnalyticsOverviewData` method. Moving forward use the `livechat/analytics/overview` endpoint. +Removes deprecated `livechat:getAnalyticsOverviewData` method. Moving forward use the `livechat/analytics/overview` endpoint.