Include only 7 most recent collaborators for document
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
import { Collection, Star, User, View } from '../models';
|
import { Collection, Star, User, View } from '../models';
|
||||||
import presentUser from './user';
|
import presentUser from './user';
|
||||||
import presentCollection from './collection';
|
import presentCollection from './collection';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
async function present(ctx, document, options) {
|
async function present(ctx, document, options) {
|
||||||
options = {
|
options = {
|
||||||
@ -56,7 +57,7 @@ async function present(ctx, document, options) {
|
|||||||
data.collaborators = await User.findAll({
|
data.collaborators = await User.findAll({
|
||||||
where: {
|
where: {
|
||||||
id: {
|
id: {
|
||||||
$in: document.collaboratorIds || [],
|
$in: _.takeRight(document.collaboratorIds, 7) || [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}).map(user => presentUser(ctx, user));
|
}).map(user => presentUser(ctx, user));
|
||||||
|
Reference in New Issue
Block a user