@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Maniphest - fix blocking / blocked task queries

Summary: Fixes T7392. I kind of stink at SQL so my approach here was to "start over" conceptually and this way makes the most sense to me - we basically do one join on the dependency table and then a second join back from the dependency table to the main task table. In the where clause we filter the resulting rows, first checking the data from dependency join for existence as appropros and then checking the second join for main task table for the proper "open" task values.

Test Plan: made a task X be blocked by task Y. closed task y. search for "not blocked" tasks and saw task X.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7392

Differential Revision: https://secure.phabricator.com/D11962

+12 -12
+12 -12
src/applications/maniphest/query/ManiphestTaskQuery.php
··· 588 588 if ($this->blockingTasks === true) { 589 589 $parts[] = qsprintf( 590 590 $conn, 591 - 'blocking.dst IS NOT NULL'); 591 + 'blocking.dst IS NOT NULL AND blockingtask.status IN (%Ls)', 592 + ManiphestTaskStatus::getOpenStatusConstants()); 592 593 } else if ($this->blockingTasks === false) { 593 594 $parts[] = qsprintf( 594 595 $conn, 595 - 'blocking.dst IS NULL'); 596 + 'blocking.dst IS NULL OR blockingtask.status NOT IN (%Ls)', 597 + ManiphestTaskStatus::getOpenStatusConstants()); 596 598 } 597 599 598 600 if ($this->blockedTasks === true) { 599 601 $parts[] = qsprintf( 600 602 $conn, 601 - 'blocked.dst IS NOT NULL'); 603 + 'blocked.dst IS NOT NULL AND blockedtask.status IN (%Ls)', 604 + ManiphestTaskStatus::getOpenStatusConstants()); 602 605 } else if ($this->blockedTasks === false) { 603 606 $parts[] = qsprintf( 604 607 $conn, 605 - 'blocked.dst IS NULL'); 608 + 'blocked.dst IS NULL OR blockedtask.status NOT IN (%Ls)', 609 + ManiphestTaskStatus::getOpenStatusConstants()); 606 610 } 607 611 608 612 return '('.implode(') OR (', $parts).')'; ··· 792 796 $conn_r, 793 797 'LEFT JOIN %T blocking ON blocking.src = task.phid '. 794 798 'AND blocking.type = %d '. 795 - 'LEFT JOIN %T blockingtask ON blocking.dst = blockingtask.phid '. 796 - 'AND blockingtask.status IN (%Ls)', 799 + 'LEFT JOIN %T blockingtask ON blocking.dst = blockingtask.phid', 797 800 $edge_table, 798 801 ManiphestTaskDependedOnByTaskEdgeType::EDGECONST, 799 - id(new ManiphestTask())->getTableName(), 800 - ManiphestTaskStatus::getOpenStatusConstants()); 802 + id(new ManiphestTask())->getTableName()); 801 803 } 802 804 if ($this->shouldJoinBlockedTasks()) { 803 805 $joins[] = qsprintf( 804 806 $conn_r, 805 807 'LEFT JOIN %T blocked ON blocked.src = task.phid '. 806 808 'AND blocked.type = %d '. 807 - 'LEFT JOIN %T blockedtask ON blocked.dst = blockedtask.phid '. 808 - 'AND blockedtask.status IN (%Ls)', 809 + 'LEFT JOIN %T blockedtask ON blocked.dst = blockedtask.phid', 809 810 $edge_table, 810 811 ManiphestTaskDependsOnTaskEdgeType::EDGECONST, 811 - id(new ManiphestTask())->getTableName(), 812 - ManiphestTaskStatus::getOpenStatusConstants()); 812 + id(new ManiphestTask())->getTableName()); 813 813 } 814 814 815 815 if ($this->anyProjectPHIDs || $this->anyUserProjectPHIDs) {