mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 07:09:48 +03:00
05b1d85398
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,]`)
32 lines
921 B
JavaScript
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}});
|
|
}
|
|
}
|