Skip to content

Commit

Permalink
chore!: remove deprecated method livechat:registerGuest (#33539)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinavkrin authored and ggazzo committed Oct 11, 2024
1 parent ec3cc20 commit d6a4ced
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 107 deletions.
5 changes: 5 additions & 0 deletions .changeset/soft-ducks-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': major
---

Removes deprecated method `livechat:registerAgent`. Moving forward, use the endpoint `livechat/visitor`.
1 change: 0 additions & 1 deletion apps/meteor/app/livechat/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import './methods/changeLivechatStatus';
import './methods/closeRoom';
import './methods/getAnalyticsChartData';
import './methods/getRoutingConfig';
import './methods/registerGuest';
import './methods/removeAllClosedRooms';
import './methods/removeCustomField';
import './methods/removeRoom';
Expand Down
96 changes: 0 additions & 96 deletions apps/meteor/app/livechat/server/methods/registerGuest.ts

This file was deleted.

15 changes: 5 additions & 10 deletions apps/meteor/tests/end-to-end/api/livechat/09-visitors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { before, describe, it, after } from 'mocha';
import moment from 'moment';
import { type Response } from 'supertest';

import { getCredentials, api, request, credentials, methodCallAnon } from '../../../data/api-data';
import { getCredentials, api, request, credentials } from '../../../data/api-data';
import { createCustomField, deleteCustomField } from '../../../data/livechat/custom-fields';
import {
makeAgentAvailable,
Expand Down Expand Up @@ -226,19 +226,14 @@ describe('LIVECHAT - visitors', () => {
await updateSetting('Livechat_Allow_collect_and_store_HTTP_header_informations', false);
});

// Note: this had to use the meteor method because the endpoint used `req.headers` which we cannot send as empty
// method doesn't pass them to the func allowing us to create a test for it
it('should allow to create a visitor without passing connectionData when GDPR setting is enabled', async () => {
const token = `${new Date().getTime()}-test`;
const response = await request
.post(methodCallAnon('livechat:registerGuest'))
.send({ message: `{"msg":"method","id":"23","method":"livechat:registerGuest","params":[{ "token": "${token}"}]}` });

expect(response.body).to.have.property('success', true);
const r = JSON.parse(response.body.message);
const { body } = await request.post(api('livechat/visitor')).send({ visitor: { token } });

expect(r.result).to.have.property('visitor');
expect(r.result.visitor).to.have.property('token', token);
expect(body).to.have.property('success', true);
expect(body).to.have.property('visitor');
expect(body.visitor).to.have.property('token', token);
});
});
});
Expand Down

0 comments on commit d6a4ced

Please sign in to comment.