Fix flow issues
This commit is contained in:
@ -31,6 +31,7 @@ async function present(ctx: Object, document: Document, options: ?Options) {
|
|||||||
team: document.teamId,
|
team: document.teamId,
|
||||||
collaborators: [],
|
collaborators: [],
|
||||||
starred: !!document.starred,
|
starred: !!document.starred,
|
||||||
|
collaboratorCount: undefined,
|
||||||
collection: undefined,
|
collection: undefined,
|
||||||
views: undefined,
|
views: undefined,
|
||||||
};
|
};
|
||||||
@ -47,12 +48,12 @@ async function present(ctx: Object, document: Document, options: ?Options) {
|
|||||||
|
|
||||||
if (options.includeCollaborators) {
|
if (options.includeCollaborators) {
|
||||||
// This could be further optimized by using ctx.cache
|
// This could be further optimized by using ctx.cache
|
||||||
data['collaborators'] = await User.findAll({
|
data.collaborators = await User.findAll({
|
||||||
where: {
|
where: {
|
||||||
id: { $in: _.takeRight(document.collaboratorIds, 10) || [] },
|
id: { $in: _.takeRight(document.collaboratorIds, 10) || [] },
|
||||||
},
|
},
|
||||||
}).map(user => presentUser(ctx, user));
|
}).map(user => presentUser(ctx, user));
|
||||||
// $FlowIssue not found in object literal?
|
|
||||||
data.collaboratorCount = document.collaboratorIds.length;
|
data.collaboratorCount = document.collaboratorIds.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user