mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-03 03:55:26 +03:00
b916300ceb
fixes https://github.com/TryGhost/Team/issues/2175 - New event type `aggregated_click_event` that is disabled by default in all the existing activity feeds - This returns click events, but only the first click events for each member/post combination. - It includes the total count of unique link clicks for that member on that post combination - Had to resort to some custom knex queries to make this work easily - Requires `@tryghost/bookshelf-pagination@0.1.31`, included in `@tryghost/bookshelf-plugins@0.6.1` (this fixes an issue with custom selects breaking the total count query of pages) - Went a bit overboard with the pagination tests to cover as much unknown edge cases as possible
56 lines
1.8 KiB
JavaScript
56 lines
1.8 KiB
JavaScript
import Controller from '@ember/controller';
|
|
import MemberFetcher from 'ghost-admin/helpers/member-fetcher';
|
|
import {EMAIL_EVENTS, NEWSLETTER_EVENTS} from 'ghost-admin/helpers/members-event-filter';
|
|
import {action} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
import {tracked} from '@glimmer/tracking';
|
|
import {use} from 'ember-could-get-used-to-this';
|
|
|
|
export default class MembersActivityController extends Controller {
|
|
@service router;
|
|
@service settings;
|
|
@service store;
|
|
|
|
queryParams = ['excludedEvents', 'member'];
|
|
|
|
@tracked excludedEvents = null;
|
|
@tracked member = null;
|
|
|
|
@use memberRecord = new MemberFetcher(() => [this.member]);
|
|
|
|
// we don't want to show or allow filtering of certain events in some situations
|
|
// - no member selected = don't show email events, they flood the list and the API can't paginate correctly
|
|
// - newsletter is disabled = don't show email or newletter events
|
|
get hiddenEvents() {
|
|
const hiddenEvents = [];
|
|
|
|
if (!this.member) {
|
|
hiddenEvents.push(...EMAIL_EVENTS);
|
|
} else {
|
|
// Always hide sent event
|
|
hiddenEvents.push('email_sent_event');
|
|
}
|
|
hiddenEvents.push('aggregated_click_event');
|
|
|
|
if (this.settings.editorDefaultEmailRecipients === 'disabled') {
|
|
hiddenEvents.push(...EMAIL_EVENTS, ...NEWSLETTER_EVENTS);
|
|
}
|
|
|
|
return hiddenEvents;
|
|
}
|
|
|
|
get fullExcludedEvents() {
|
|
return (this.excludedEvents || '').split(',').concat(this.hiddenEvents);
|
|
}
|
|
|
|
@action
|
|
changeExcludedEvents(newList) {
|
|
this.router.transitionTo({queryParams: {excludedEvents: newList}});
|
|
}
|
|
|
|
@action
|
|
changeMember(member) {
|
|
this.router.transitionTo({queryParams: {member: member?.id}});
|
|
}
|
|
}
|