Ghost/ghost/admin/app/routes/subscribers.js
Kevin Ansfield a7f4610381 Removed usage of ember-light-table in subscribers screen (#1191)
no issue

`ember-light-table` is falling behind Ember.js and other addon development and is increasingly causing issues with Ember deprecations and addon incompatibility.

- swaps `ember-light-table` usage for a straightforward table using `vertical-collection` for occlusion
- uses the same loading mechanism as the members screen with a slight optimisation where the initial load will fetch subscribers in batches of 200 until they are all loaded
- removes now-unused pagination mixin
- fixes duplicate subscriber validation handling
2019-05-07 12:39:56 +01:00

32 lines
868 B
JavaScript

import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
import RSVP from 'rsvp';
import {inject as service} from '@ember/service';
export default AuthenticatedRoute.extend({
feature: service(),
titleToken: 'Subscribers',
// redirect if subscribers is disabled or user isn't owner/admin
beforeModel() {
this._super(...arguments);
let promises = {
user: this.get('session.user'),
subscribers: this.get('feature.subscribers')
};
return RSVP.hash(promises).then((hash) => {
let {user, subscribers} = hash;
if (!subscribers || !user.isOwnerOrAdmin) {
return this.transitionTo('home');
}
});
},
setupController(controller) {
this._super(...arguments);
controller.fetchSubscribers.perform();
}
});