Skip to content

Commit

Permalink
chore!: removed deprecated methods livechat:saveTrigger livechat:remo…
Browse files Browse the repository at this point in the history
…veTrigger

Signed-off-by: Abhinav Kumar <abhinav@avitechlab.com>
  • Loading branch information
abhinavkrin committed Oct 3, 2024
1 parent 09d45b8 commit bc168bf
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 105 deletions.
5 changes: 5 additions & 0 deletions .changeset/hot-socks-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': major
---

Removed deprecated methods `livechat:saveTrigger` and `livechat:removeTrigger`. Moving forward use the endpoints `livechat/triggers (POST)` and `livechat/triggers/:_id (DELETE)` respectively.
2 changes: 0 additions & 2 deletions apps/meteor/app/livechat/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import './methods/removeAllClosedRooms';
import './methods/removeCustomField';
import './methods/removeDepartment';
import './methods/removeManager';
import './methods/removeTrigger';
import './methods/removeRoom';
import './methods/saveAgentInfo';
import './methods/saveAppearance';
Expand All @@ -43,7 +42,6 @@ import './methods/saveDepartmentAgents';
import './methods/saveInfo';
import './methods/saveIntegration';
import './methods/saveSurveyFeedback';
import './methods/saveTrigger';
import './methods/sendMessageLivechat';
import './methods/sendFileLivechatMessage';
import './methods/sendOfflineMessage';
Expand Down
33 changes: 0 additions & 33 deletions apps/meteor/app/livechat/server/methods/removeTrigger.ts

This file was deleted.

45 changes: 0 additions & 45 deletions apps/meteor/app/livechat/server/methods/saveTrigger.ts

This file was deleted.

49 changes: 24 additions & 25 deletions apps/meteor/tests/data/livechat/triggers.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
import { faker } from '@faker-js/faker';
import type { ILivechatTrigger } from '@rocket.chat/core-typings';

import { api, credentials, methodCall, request } from '../api-data';
import { api, credentials, request } from '../api-data';
import type { DummyResponse } from './utils';

export const createTrigger = (name: string): Promise<boolean> => {
return new Promise((resolve, reject) => {
void request
.post(methodCall(`livechat:saveTrigger`))
.post(api('livechat/triggers'))
.set(credentials)
.send({
message: JSON.stringify({
method: 'livechat:saveTrigger',
params: [
{
name,
description: faker.lorem.sentence(),
enabled: true,
runOnce: faker.datatype.boolean(),
actions: [
{
name: 'send-message',
params: {
msg: faker.lorem.sentence(),
name: faker.person.firstName(),
sender: faker.helpers.arrayElement(['queue', 'custom']),
},
},
],
conditions: [{ name: faker.lorem.word(), value: faker.number.int() }],
name,
description: faker.lorem.sentence(),
enabled: true,
runOnce: faker.datatype.boolean(),
actions: [
{
name: 'send-message',
params: {
msg: faker.lorem.sentence(),
name: faker.person.firstName(),
sender: faker.helpers.arrayElement(['queue', 'custom']),
},
],
id: '101',
msg: 'method',
}),
},
],
conditions: [
{
name: faker.helpers.arrayElement(['time-on-site', 'page-url', 'chat-opened-by-visitor', 'after-guest-registration']),
value: faker.string.alpha(),
},
],
})
.expect((res) => {
console.log(res.body);
})
.end((err: Error, _res: DummyResponse<boolean, 'unwrapped'>) => {
if (err) {
Expand Down

0 comments on commit bc168bf

Please sign in to comment.