mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 01:42:29 +03:00
592e3df794
no-issue This adds the ability to apply complex filters to members, as well as to perform bulk actions on the filtered set, including unsubscribing, adding & removing labels.
45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default class MembersRoute extends AuthenticatedRoute {
|
|
@service store;
|
|
@service feature;
|
|
|
|
queryParams = {
|
|
label: {refreshModel: true},
|
|
searchParam: {refreshModel: true, replace: true},
|
|
paidParam: {refreshModel: true},
|
|
orderParam: {refreshModel: true},
|
|
filterParam: {refreshModel: true}
|
|
};
|
|
|
|
// redirect to posts screen if:
|
|
// - TODO: members is disabled?
|
|
// - logged in user isn't owner/admin
|
|
beforeModel() {
|
|
super.beforeModel(...arguments);
|
|
if (!this.session.user.isAdmin) {
|
|
return this.transitionTo('home');
|
|
}
|
|
}
|
|
|
|
model(params) {
|
|
this.controllerFor('members').resetFilters(params);
|
|
return this.controllerFor('members').fetchMembersTask.perform(params);
|
|
}
|
|
|
|
// trigger a background load of members plus labels for filter dropdown
|
|
setupController(controller) {
|
|
super.setupController(...arguments);
|
|
controller.fetchLabelsTask.perform();
|
|
}
|
|
|
|
buildRouteInfoMetadata() {
|
|
return {
|
|
titleToken: 'Members',
|
|
mainClasses: ['gh-main-fullwidth']
|
|
|
|
};
|
|
}
|
|
}
|