Skip to content

Commit

Permalink
remove record_event
Browse files Browse the repository at this point in the history
see slack
  • Loading branch information
bnchdrff committed Apr 25, 2018
1 parent 5257b62 commit 12f850b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 30 deletions.
1 change: 0 additions & 1 deletion src/app/utils/ServerApiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 } },
Expand Down
29 changes: 0 additions & 29 deletions src/server/api/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 12f850b

Please sign in to comment.