mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
bac71559f3
closes #3563 - before attempting to revoke an invitation, get updated model info - reload route and show warning if user info has changed
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import PaginationRouteMixin from 'ghost/mixins/pagination-route';
|
|
|
|
var paginationSettings = {
|
|
page: 1,
|
|
limit: 20,
|
|
status: 'all'
|
|
};
|
|
|
|
var UsersIndexRoute = Ember.Route.extend(SimpleAuth.AuthenticatedRouteMixin, PaginationRouteMixin, {
|
|
setupController: function (controller, model) {
|
|
this._super(controller, model);
|
|
this.setupPagination(paginationSettings);
|
|
},
|
|
|
|
model: function () {
|
|
var self = this;
|
|
return this.store.find('user', 'me').then(function (currentUser) {
|
|
if (currentUser.get('isEditor')) {
|
|
// Editors only see authors in the list
|
|
paginationSettings.role = 'Author';
|
|
}
|
|
return self.store.filter('user', paginationSettings, function (user) {
|
|
if (currentUser.get('isEditor')) {
|
|
return user.get('isAuthor');
|
|
}
|
|
return true;
|
|
});
|
|
});
|
|
},
|
|
|
|
actions: {
|
|
reload: function () {
|
|
this.refresh();
|
|
}
|
|
}
|
|
});
|
|
|
|
export default UsersIndexRoute;
|