Skip to content

Commit

Permalink
refactor(logs): isolate parts of code to be more easily modified (refs
Browse files Browse the repository at this point in the history
  • Loading branch information
naholyr committed Sep 26, 2017
1 parent a3334fb commit 526a99d
Show file tree
Hide file tree
Showing 2 changed files with 266 additions and 266 deletions.
12 changes: 6 additions & 6 deletions server/lib/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,9 @@ const listViewablePeople = (req, options = {}) => {
// when no dates are there, we don't modify isMember. No time constraints set.

// we look for members with sometimes a range or for externals
const filters = includeRange || includeMembers ?{ 'memberships': { $elemMatch: { $and: isMember } } } : isExternal
const filters = includeRange || includeMembers
? { 'memberships': { $elemMatch: { $and: isMember } } }
: isExternal

// here the mongo query of the death
return People.aggregate()
Expand Down Expand Up @@ -369,12 +371,10 @@ const listViewablePeople = (req, options = {}) => {
.project({ _id: 1 }) // Keep only id
.then(map('_id'))
.then(ids => {
let query
if (includeExternals)
const query = includeExternals
//add external people which doesn't have any academicMembership
query = { $or: [ { academicMemberships: { $exists:false } }, { academicMemberships:[] }, { _id: { $in: ids } } ] }
else
query = { _id: { $in: ids } }
? { $or: [ { academicMemberships: { $exists:false } }, { academicMemberships:[] }, { _id: { $in: ids } } ] }
: { _id: { $in: ids } }

return {
//Populate to allow getPeoplePermissions to work
Expand Down
Loading

0 comments on commit 526a99d

Please sign in to comment.