Skip to content
This repository has been archived by the owner on Nov 21, 2020. It is now read-only.

Commit

Permalink
feat(ticket/task/deal): add no labels assigned filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Buyantogtokh authored and batamar committed Nov 8, 2019
1 parent 59de3f8 commit 38e3373
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"graphql": "^14.0.2",
"graphql-redis-subscriptions": "^1.4.0",
"graphql-tools": "^4.0.3",
"handlebars": "^4.4.3",
"handlebars": "^4.5.1",
"ioredis": "^3.2.2",
"jsonwebtoken": "^8.1.0",
"meteor-random": "^0.0.3",
Expand Down
8 changes: 5 additions & 3 deletions src/data/resolvers/queries/boardUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const generateCommonFilters = async (args: any) => {
labelIds,
} = args;

const assignedToNoOne = value => {
const isListEmpty = value => {
return value.length === 1 && value[0].length === 0;
};

Expand All @@ -43,7 +43,7 @@ export const generateCommonFilters = async (args: any) => {

if (assignedUserIds) {
// Filter by assigned to no one
const notAssigned = assignedToNoOne(assignedUserIds);
const notAssigned = isListEmpty(assignedUserIds);

filter.assignedUserIds = notAssigned ? contains([], true) : contains(assignedUserIds);
}
Expand Down Expand Up @@ -163,7 +163,9 @@ export const generateCommonFilters = async (args: any) => {
}

if (labelIds) {
filter.labelIds = { $in: labelIds };
const isEmpty = isListEmpty(labelIds);

filter.labelIds = isEmpty ? { $in: [null, []] } : { $in: labelIds };
}

return filter;
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4401,10 +4401,10 @@ handlebars@^4.1.0:
optionalDependencies:
uglify-js "^3.1.4"

handlebars@^4.4.3:
version "4.4.3"
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.4.3.tgz#180bae52c1d0e9ec0c15d7e82a4362d662762f6e"
integrity sha512-B0W4A2U1ww3q7VVthTKfh+epHx+q4mCt6iK+zEAzbMBpWQAwxCeKxEGpj/1oQTpzPXDNSOG7hmG14TsISH50yw==
handlebars@^4.5.1:
version "4.5.1"
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.5.1.tgz#8a01c382c180272260d07f2d1aa3ae745715c7ba"
integrity sha512-C29UoFzHe9yM61lOsIlCE5/mQVGrnIOrOq7maQl76L7tYPCgC1og0Ajt6uWnX4ZTxBPnjw+CUvawphwCfJgUnA==
dependencies:
neo-async "^2.6.0"
optimist "^0.6.1"
Expand Down

0 comments on commit 38e3373

Please sign in to comment.