@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.

Allow tasks to be filtered and ordered by closed date

Summary: Depends on D19038. Fixes T4434. Updates the SearchEngine and Query to handle these fields.

Test Plan: Filtered and ordered by date and closer.

Maniphest Tasks: T4434

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

+70 -1
+48 -1
src/applications/maniphest/query/ManiphestTaskQuery.php
··· 23 23 private $parentTaskIDs; 24 24 private $subtaskIDs; 25 25 private $subtypes; 26 + private $closedEpochMin; 27 + private $closedEpochMax; 28 + private $closerPHIDs; 26 29 27 30 private $status = 'status-any'; 28 31 const STATUS_ANY = 'status-any'; ··· 176 179 177 180 public function withDateModifiedAfter($date_modified_after) { 178 181 $this->dateModifiedAfter = $date_modified_after; 182 + return $this; 183 + } 184 + 185 + public function withClosedEpochBetween($min, $max) { 186 + $this->closedEpochMin = $min; 187 + $this->closedEpochMax = $max; 188 + return $this; 189 + } 190 + 191 + public function withCloserPHIDs(array $phids) { 192 + $this->closerPHIDs = $phids; 179 193 return $this; 180 194 } 181 195 ··· 379 393 $this->dateModifiedBefore); 380 394 } 381 395 396 + if ($this->closedEpochMin !== null) { 397 + $where[] = qsprintf( 398 + $conn, 399 + 'task.closedEpoch >= %d', 400 + $this->closedEpochMin); 401 + } 402 + 403 + if ($this->closedEpochMax !== null) { 404 + $where[] = qsprintf( 405 + $conn, 406 + 'task.closedEpoch <= %d', 407 + $this->closedEpochMax); 408 + } 409 + 410 + if ($this->closerPHIDs !== null) { 411 + $where[] = qsprintf( 412 + $conn, 413 + 'task.closerPHID IN (%Ls)', 414 + $this->closerPHIDs); 415 + } 416 + 382 417 if ($this->priorities !== null) { 383 418 $where[] = qsprintf( 384 419 $conn, ··· 722 757 'outdated' => array( 723 758 'vector' => array('-updated', '-id'), 724 759 'name' => pht('Date Updated (Oldest First)'), 725 - ), 760 + ), 761 + 'closed' => array( 762 + 'vector' => array('closed', 'id'), 763 + 'name' => pht('Date Closed (Latest First)'), 764 + ), 726 765 'title' => array( 727 766 'vector' => array('title', 'id'), 728 767 'name' => pht('Title'), ··· 741 780 'outdated', 742 781 'newest', 743 782 'oldest', 783 + 'closed', 744 784 'title', 745 785 )) + $orders; 746 786 ··· 790 830 'column' => 'dateModified', 791 831 'type' => 'int', 792 832 ), 833 + 'closed' => array( 834 + 'table' => 'task', 835 + 'column' => 'closedEpoch', 836 + 'type' => 'int', 837 + 'null' => 'tail', 838 + ), 793 839 ); 794 840 } 795 841 ··· 808 854 'status' => $task->getStatus(), 809 855 'title' => $task->getTitle(), 810 856 'updated' => $task->getDateModified(), 857 + 'closed' => $task->getClosedEpoch(), 811 858 ); 812 859 813 860 foreach ($keys as $key) {
+22
src/applications/maniphest/query/ManiphestTaskSearchEngine.php
··· 126 126 id(new PhabricatorSearchDateField()) 127 127 ->setLabel(pht('Updated Before')) 128 128 ->setKey('modifiedEnd'), 129 + id(new PhabricatorSearchDateField()) 130 + ->setLabel(pht('Closed After')) 131 + ->setKey('closedStart'), 132 + id(new PhabricatorSearchDateField()) 133 + ->setLabel(pht('Closed Before')) 134 + ->setKey('closedEnd'), 135 + id(new PhabricatorUsersSearchField()) 136 + ->setLabel(pht('Closed By')) 137 + ->setKey('closerPHIDs') 138 + ->setAliases(array('closer', 'closerPHID', 'closers')) 139 + ->setDescription(pht('Search for tasks closed by certain users.')), 129 140 id(new PhabricatorSearchTextField()) 130 141 ->setLabel(pht('Page Size')) 131 142 ->setKey('limit'), ··· 153 164 'createdEnd', 154 165 'modifiedStart', 155 166 'modifiedEnd', 167 + 'closedStart', 168 + 'closedEnd', 169 + 'closerPHIDs', 156 170 'limit', 157 171 ); 158 172 } ··· 206 220 207 221 if ($map['modifiedEnd']) { 208 222 $query->withDateModifiedBefore($map['modifiedEnd']); 223 + } 224 + 225 + if ($map['closedStart'] || $map['closedEnd']) { 226 + $query->withClosedEpochBetween($map['closedStart'], $map['closedEnd']); 227 + } 228 + 229 + if ($map['closerPHIDs']) { 230 + $query->withCloserPHIDs($map['closerPHIDs']); 209 231 } 210 232 211 233 if ($map['hasParents'] !== null) {