Skip to content

Commit

Permalink
[FIX] GDPR action to forget visitor data on request (#24441)
Browse files Browse the repository at this point in the history
Co-authored-by: Murtaza Patrawala <34130764+murtaza98@users.noreply.github.com>
  • Loading branch information
KevLehman and murtaza98 authored Feb 16, 2022
1 parent 61fa8f1 commit c83a78f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/livechat/server/api/v1/visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { findGuest, normalizeHttpHeaderData } from '../lib/livechat';
import { Livechat } from '../../lib/Livechat';
import { ILivechatVisitorDTO } from '../../../../../definition/ILivechatVisitor';
import { IRoom } from '../../../../../definition/IRoom';
import { settings } from '../../../../settings/server';

API.v1.addRoute('livechat/visitor', {
async post() {
Expand Down Expand Up @@ -104,7 +105,8 @@ API.v1.addRoute('livechat/visitor/:token', {
},
}).fetch();

if (rooms?.length) {
// if gdpr is enabled, bypass rooms check
if (rooms?.length && !settings.get('Livechat_Allow_collect_and_store_HTTP_header_informations')) {
throw new Meteor.Error('visitor-has-open-rooms', 'Cannot remove visitors with opened rooms');
}

Expand Down
8 changes: 6 additions & 2 deletions app/livechat/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ Meteor.startup(function () {
alert: 'Force_visitor_to_accept_data_processing_consent_enabled_alert',
i18nLabel: 'Force_visitor_to_accept_data_processing_consent',
i18nDescription: 'Force_visitor_to_accept_data_processing_consent_description',
enableQuery: omnichannelEnabledQuery,
enableQuery: [omnichannelEnabledQuery, { _id: 'Livechat_Allow_collect_and_store_HTTP_header_informations', value: true }],
});

this.add('Livechat_data_processing_consent_text', '', {
Expand All @@ -578,7 +578,11 @@ Meteor.startup(function () {
public: true,
i18nLabel: 'Data_processing_consent_text',
i18nDescription: 'Data_processing_consent_text_description',
enableQuery: [{ _id: 'Livechat_force_accept_data_processing_consent', value: true }, omnichannelEnabledQuery],
enableQuery: [
{ _id: 'Livechat_force_accept_data_processing_consent', value: true },
{ _id: 'Livechat_Allow_collect_and_store_HTTP_header_informations', value: true },
omnichannelEnabledQuery,
],
});

this.add('Livechat_agent_leave_action', 'none', {
Expand Down

0 comments on commit c83a78f

Please sign in to comment.