Skip to content

Commit

Permalink
[FIX] Allow storing the navigation history of unregistered Livechat v…
Browse files Browse the repository at this point in the history
…isitors (#14970)

* Remove validations before storing visitor navigation history.

* Removed unused imports.
  • Loading branch information
renatobecker authored Jul 11, 2019
1 parent 7f88780 commit f63c9e6
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions app/livechat/server/api/v1/pageVisited.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { Meteor } from 'meteor/meteor';
import { Match, check } from 'meteor/check';
import _ from 'underscore';

import { API } from '../../../../api';
import { findGuest, findRoom } from '../lib/livechat';
import { Livechat } from '../../lib/Livechat';

API.v1.addRoute('livechat/page.visited', {
post() {
try {
check(this.bodyParams, {
token: String,
rid: String,
rid: Match.Maybe(String),
pageInfo: Match.ObjectIncluding({
change: String,
title: String,
Expand All @@ -22,17 +20,6 @@ API.v1.addRoute('livechat/page.visited', {
});

const { token, rid, pageInfo } = this.bodyParams;

const guest = findGuest(token);
if (!guest) {
throw new Meteor.Error('invalid-token');
}

const room = findRoom(token, rid);
if (!room) {
throw new Meteor.Error('invalid-room');
}

const obj = Livechat.savePageHistory(token, rid, pageInfo);
if (obj) {
const page = _.pick(obj, 'msg', 'navigation');
Expand Down

0 comments on commit f63c9e6

Please sign in to comment.