Skip to content

Commit

Permalink
Filter out items in personal space except for current user (#4063)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaskikutis authored Feb 17, 2022
1 parent f772fd4 commit 4bf20da
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions scripts/apps/search/services/SearchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -667,10 +667,18 @@ export function SearchService($location, session, multi,
this.filter({not: {term: {state: 'scheduled'}}});
}

// remove other users drafts.
this.filter({or: [{and: [{term: {state: 'draft'}},
{term: {original_creator: session.identity._id}}]},
{not: {terms: {state: ['draft']}}}]});
/**
* Filter out personal items that don't belong to current user.
*/
this.filter({
not: {
and: [ // matches personal items that belong to other users
{not: {exists: {field: 'task.desk'}}},
{exists: {field: 'task.user'}},
{not: {term: {'task.user': session.identity._id}}},
],
},
});

// this is needed for archived collection
this.filter({not: {term: {package_type: 'takes'}}});
Expand Down

0 comments on commit 4bf20da

Please sign in to comment.