From 251771e3459ba31966a5f1b00c6815bfa86c0def Mon Sep 17 00:00:00 2001 From: Jori Lallo Date: Fri, 30 Jun 2017 00:51:00 -0700 Subject: [PATCH] Include only 7 most recent collaborators for document --- server/presenters/document.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/presenters/document.js b/server/presenters/document.js index 8757ed7e..b6024a7e 100644 --- a/server/presenters/document.js +++ b/server/presenters/document.js @@ -1,6 +1,7 @@ import { Collection, Star, User, View } from '../models'; import presentUser from './user'; import presentCollection from './collection'; +import _ from 'lodash'; async function present(ctx, document, options) { options = { @@ -56,7 +57,7 @@ async function present(ctx, document, options) { data.collaborators = await User.findAll({ where: { id: { - $in: document.collaboratorIds || [], + $in: _.takeRight(document.collaboratorIds, 7) || [], }, }, }).map(user => presentUser(ctx, user));