From 130aa755bb0e501ba23a3668f05792f3ee7db85c Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Sun, 1 Mar 2015 09:39:07 +1100 Subject: [PATCH] Exclude closed tasks from blocked/blocking filter Summary: Fixes T7392. When filtering blocked/blocking Maniphest tasks, don't consider closed tasks. Test Plan: # Created `T1` and `T2` with `T2 depends on T1`. # Marked `T1` as resolved. # Searched for tasks "blocked by other tasks" and noted that `T2` wasn't in the result set. Reviewers: btrahan, #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7392 Differential Revision: https://secure.phabricator.com/D11911 --- .../maniphest/query/ManiphestTaskQuery.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php index bf1e295af4..74e18ce125 100644 --- a/src/applications/maniphest/query/ManiphestTaskQuery.php +++ b/src/applications/maniphest/query/ManiphestTaskQuery.php @@ -791,17 +791,25 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery { $joins[] = qsprintf( $conn_r, 'LEFT JOIN %T blocking ON blocking.src = task.phid '. - 'AND blocking.type = %d', + 'AND blocking.type = %d '. + 'JOIN %T blockingtask ON blocking.dst = blockingtask.phid '. + 'AND blockingtask.status IN (%Ls)', $edge_table, - ManiphestTaskDependedOnByTaskEdgeType::EDGECONST); + ManiphestTaskDependedOnByTaskEdgeType::EDGECONST, + id(new ManiphestTask())->getTableName(), + ManiphestTaskStatus::getOpenStatusConstants()); } if ($this->shouldJoinBlockedTasks()) { $joins[] = qsprintf( $conn_r, 'LEFT JOIN %T blocked ON blocked.src = task.phid '. - 'AND blocked.type = %d', + 'AND blocked.type = %d '. + 'JOIN %T blockedtask ON blocked.dst = blockedtask.phid '. + 'AND blockedtask.status IN (%Ls)', $edge_table, - ManiphestTaskDependsOnTaskEdgeType::EDGECONST); + ManiphestTaskDependsOnTaskEdgeType::EDGECONST, + id(new ManiphestTask())->getTableName(), + ManiphestTaskStatus::getOpenStatusConstants()); } if ($this->anyProjectPHIDs || $this->anyUserProjectPHIDs) {