This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Fixed infinite scroll on the team screen (#1095)
closes TryGhost/Ghost#10307 - removed infinite scroll from the team screen - adjusted team screen behaviour to pull from the local cache and update in the background to speed up navigation to the screen - use `{{vertical-collection}}` to render the users list for faster initial render with many users
- Loading branch information
1 parent
bccd9ea
commit 782ff71
Showing
4 changed files
with
77 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,27 @@ | ||
import AuthenticatedRoute from 'ghost-admin/routes/authenticated'; | ||
import CurrentUserSettings from 'ghost-admin/mixins/current-user-settings'; | ||
import RSVP from 'rsvp'; | ||
import styleBody from 'ghost-admin/mixins/style-body'; | ||
import {inject as service} from '@ember/service'; | ||
|
||
export default AuthenticatedRoute.extend(styleBody, CurrentUserSettings, { | ||
infinity: service(), | ||
session: service(), | ||
|
||
titleToken: 'Team', | ||
classNames: ['view-team'], | ||
|
||
modelPath: 'controller.activeUsers', | ||
perPage: 15, | ||
|
||
model() { | ||
return this.get('session.user').then((user) => { | ||
let modelPath = this.get('modelPath'); | ||
let perPage = this.get('perPage'); | ||
|
||
let modelPromises = { | ||
activeUsers: this.infinity.model('user', { | ||
modelPath, | ||
perPage, | ||
filter: 'status:-inactive', | ||
startingPage: 1, | ||
perPageParam: 'limit', | ||
totalPagesParam: 'meta.pagination.pages' | ||
}) | ||
}; | ||
|
||
// authors do not have permission to hit the invites or suspended users endpoint | ||
if (!user.get('isAuthorOrContributor')) { | ||
modelPromises.invites = this.store.query('invite', {limit: 'all'}) | ||
.then(() => this.store.peekAll('invite')); | ||
|
||
// fetch suspended users separately so that infinite scroll still works | ||
modelPromises.suspendedUsers = this.store.query('user', {limit: 'all', filter: 'status:inactive'}); | ||
} | ||
|
||
// we need to load the roles into ember cache | ||
// invites return role_id only and we do not offer a /role/:id endpoint | ||
modelPromises.roles = this.get('store').query('role', {}); | ||
|
||
return RSVP.hash(modelPromises); | ||
}); | ||
return this.session.user; | ||
}, | ||
|
||
setupController(controller, models) { | ||
controller.setProperties(models); | ||
setupController(controller) { | ||
this._super(...arguments); | ||
controller.backgroundUpdate.perform(); | ||
}, | ||
|
||
actions: { | ||
reload() { | ||
this.refresh(); | ||
this.controller.backgroundUpdate.perform(); | ||
} | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters