Skip to content

Commit

Permalink
chore!: remove deprecated livechat:saveTrigger and livechat:removeTri…
Browse files Browse the repository at this point in the history
…gger method (#33429)
  • Loading branch information
abhinavkrin authored and ggazzo committed Oct 15, 2024
1 parent c0aa044 commit 614930b
Show file tree
Hide file tree
Showing 5 changed files with 26 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 @@ -26,13 +26,11 @@ import './methods/getRoutingConfig';
import './methods/registerGuest';
import './methods/removeAllClosedRooms';
import './methods/removeCustomField';
import './methods/removeTrigger';
import './methods/removeRoom';
import './methods/saveAgentInfo';
import './methods/saveCustomField';
import './methods/saveDepartment';
import './methods/saveDepartmentAgents';
import './methods/saveTrigger';
import './methods/sendMessageLivechat';
import './methods/sendFileLivechatMessage';
import './methods/setDepartmentForVisitor';
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.

46 changes: 21 additions & 25 deletions apps/meteor/tests/data/livechat/triggers.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,35 @@
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(),
},
],
})
.end((err: Error, _res: DummyResponse<boolean, 'unwrapped'>) => {
if (err) {
Expand Down

0 comments on commit 614930b

Please sign in to comment.