Skip to content

Commit

Permalink
add sensitive event types (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhagmajer committed Jan 27, 2022
1 parent 246c6da commit 8481175
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/commands/events/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ const date = require('date-fns');
const DEFAULT_START_TIME = '-5d';
const DEFAULT_END_TIME = 'now';

const eventReplacements = {
ADMIN_INVITE_ACCEPT: 'MASTER_INVITE_ACCEPT',
ADMIN_INVITE_REJECT: 'MASTER_INVITE_REJECT',
}

class EventsGetCommand extends BoxCommand {
async run() {
const { flags, args } = this.parse(EventsGetCommand);
Expand All @@ -19,7 +24,13 @@ class EventsGetCommand extends BoxCommand {
options.limit = flags.limit;
}
if (flags['event-types']) {
options.event_type = flags['event-types'];
const joinedEvents = flags['event-types'];
const events = joinedEvents.split(',');
const mappedEvents = events.map((event) => {
const replacement = eventReplacements[event];
return replacement ? replacement : event;
});
options.event_type = mappedEvents.join(',');
}

if (flags['stream-position']) {
Expand Down

0 comments on commit 8481175

Please sign in to comment.