Ghost/ghost/admin/app/controllers/members-activity.js
Kevin Ansfield 05b1d85398 Fixed invalid filter query for members events
refs https://github.com/TryGhost/Team/issues/1277

- we were inadvertently adding an empty string to the excluded events set resulting in a trailing comma in the filter string (`type:-[x,y,z,]`)
2022-01-25 10:12:24 +00:00

32 lines
921 B
JavaScript

import Controller from '@ember/controller';
import {action} from '@ember/object';
import {inject as service} from '@ember/service';
import {tracked} from '@glimmer/tracking';
export default class MembersActivityController extends Controller {
@service router;
queryParams = ['excludedEvents'];
@tracked excludedEvents = null;
get filter() {
let excludedEvents = this.member ?
new Set() :
new Set(['email_opened_event', 'email_delivered_event', 'email_failed_event']);
(this.excludedEvents || '').split(',').forEach(event => event && excludedEvents.add(event));
if (excludedEvents.size > 0) {
return `type:-[${Array.from(excludedEvents).join(',')}]`;
} else {
return '';
}
}
@action
updateExcludedEvents(newList) {
this.router.transitionTo({queryParams: {excludedEvents: newList}});
}
}