From 12f850bc68f16da6cee61a3ce10d277b7d65e411 Mon Sep 17 00:00:00 2001 From: Benjamin Chodoroff Date: Wed, 25 Apr 2018 11:30:35 -0400 Subject: [PATCH] remove record_event see slack --- src/app/utils/ServerApiClient.js | 1 - src/server/api/general.js | 29 ----------------------------- 2 files changed, 30 deletions(-) diff --git a/src/app/utils/ServerApiClient.js b/src/app/utils/ServerApiClient.js index 7cf0898938..2b0f87c30c 100644 --- a/src/app/utils/ServerApiClient.js +++ b/src/app/utils/ServerApiClient.js @@ -35,7 +35,6 @@ export function serverApiRecordEvent(type, val, rate_limit_ms = 5000) { const request = Object.assign({}, request_base, { body: JSON.stringify({ csrf: $STM_csrf, type, value }), }); - fetch('/api/v1/record_event', request); api.call( 'overseer.collect', { collection: 'event', metadata: { type, value } }, diff --git a/src/server/api/general.js b/src/server/api/general.js index e60ed8892c..ea26a96789 100644 --- a/src/server/api/general.js +++ b/src/server/api/general.js @@ -492,35 +492,6 @@ export default function useGeneralApi(app) { } }); - router.post('/record_event', koaBody, function*() { - if (rateLimitReq(this, this.req)) return; - try { - const params = this.request.body; - const { csrf, type, value } = - typeof params === 'string' ? JSON.parse(params) : params; - if (!checkCSRF(this, csrf)) return; - logRequest('record_event', this, { type, value }); - const str_value = - typeof value === 'string' ? value : JSON.stringify(value); - if (type.match(/^[A-Z]/)) { - if (mixpanel) { - mixpanel.track(type, { - distinct_id: this.session.uid, - Page: str_value, - }); - mixpanel.people.increment(this.session.uid, type, 1); - } - } else { - recordWebEvent(this, type, str_value); - } - this.body = JSON.stringify({ status: 'ok' }); - } catch (error) { - console.error('Error in /record_event api call', error.message); - this.body = JSON.stringify({ error: error.message }); - this.status = 500; - } - }); - router.post('/csp_violation', function*() { if (rateLimitReq(this, this.req)) return; let params;