make variable naming more clear

GitOrigin-RevId: fba9406b20d21baaadc2e2fadc9597914396f85a
This commit is contained in:
Ersun Warncke 2020-06-15 11:17:16 -04:00 committed by Copybot
parent b335bcb67d
commit b73319acc1

View file

@ -120,14 +120,18 @@ async function enqueue(group, method, job) {
async function getProjectUsersIds(projectId) {
// get list of all user ids with access to project. project owner
// will always be the first entry in the list.
const projectUserIds = await CollaboratorsGetter.getInvitedMemberIds(
projectId
)
// filter list to only return users with dropbox linked
// skip the first user id, which is always returned
const [
ownerUserId,
...invitedUserIds
] = await CollaboratorsGetter.getInvitedMemberIds(projectId)
// if there are no invited users, always return the owner
if (!invitedUserIds.length) {
return [ownerUserId]
}
// filter invited users to only return those with dropbox linked
const dropboxUsers = await UserGetter.getUsers(
{
_id: { $in: projectUserIds.slice(1).map(id => ObjectId(id)) },
_id: { $in: invitedUserIds.map(id => ObjectId(id)) },
'dropbox.access_token.uid': { $ne: null }
},
{
@ -135,7 +139,7 @@ async function getProjectUsersIds(projectId) {
}
)
const dropboxUserIds = dropboxUsers.map(user => user._id)
return [projectUserIds[0], ...dropboxUserIds]
return [ownerUserId, ...dropboxUserIds]
}
async function moveEntity(options) {