mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
ffe0f84700
closes https://github.com/TryGhost/Ghost/issues/12421 - added `emailOpenRate` property to member model - added open-rate column to the members list - hidden when email analytics is disabled - added `{{feature "flag"}}` helper so feature flags can be checked in templates without injecting the feature service into the backing class - added `order` query param to the members controller/route and wired it into the data fetching routine - added order dropdown to the filter bar with "Newest" (default) and "Open rate" as the two options - whole dropdown is hidden if email analytics is disabled Co-authored-by: Kevin Ansfield <kevin@lookingsideways.co.uk>
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default class MembersRoute extends AuthenticatedRoute {
|
|
@service store;
|
|
|
|
queryParams = {
|
|
label: {refreshModel: true},
|
|
searchParam: {refreshModel: true, replace: true},
|
|
paidParam: {refreshModel: true},
|
|
orderParam: {refreshModel: true}
|
|
};
|
|
|
|
// redirect to posts screen if:
|
|
// - TODO: members is disabled?
|
|
// - logged in user isn't owner/admin
|
|
beforeModel() {
|
|
super.beforeModel(...arguments);
|
|
return this.session.user.then((user) => {
|
|
if (!user.isOwnerOrAdmin) {
|
|
return this.transitionTo('home');
|
|
}
|
|
});
|
|
}
|
|
|
|
model(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'
|
|
};
|
|
}
|
|
}
|