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

Restore project filtering to Maniphest "pro" search

Summary: Restores any/all/user/exclude project filters to the new search.

Test Plan: Filtered stuff by projects.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

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

+124 -10
+7
src/applications/maniphest/query/ManiphestTaskQuery.php
··· 184 184 } 185 185 186 186 public function loadPage() { 187 + 188 + // TODO: (T603) It is possible for a user to find the PHID of a project 189 + // they can't see, then query for tasks in that project and deduce the 190 + // identity of unknown/invisible projects. Before we allow the user to 191 + // execute a project-based PHID query, we should verify that they 192 + // can see the project. 193 + 187 194 $task_dao = new ManiphestTask(); 188 195 $conn = $task_dao->establishConnection('r'); 189 196
+107 -10
src/applications/maniphest/query/ManiphestTaskSearchEngine.php
··· 33 33 34 34 $saved->setParameter('fulltext', $request->getStr('fulltext')); 35 35 36 + $saved->setParameter( 37 + 'allProjectPHIDs', 38 + $request->getArr('allProjects')); 39 + 40 + $saved->setParameter( 41 + 'withNoProject', 42 + $request->getBool('withNoProject')); 43 + 44 + $saved->setParameter( 45 + 'anyProjectPHIDs', 46 + $request->getArr('anyProjects')); 47 + 48 + $saved->setParameter( 49 + 'excludeProjectPHIDs', 50 + $request->getArr('excludeProjects')); 51 + 52 + $saved->setParameter( 53 + 'userProjectPHIDs', 54 + $this->readUsersFromRequest($request, 'userProjects')); 55 + 36 56 return $saved; 37 57 } 38 58 ··· 82 102 $query->withFullTextSearch($fulltext); 83 103 } 84 104 105 + $with_no_project = $saved->getParameter('withNoProject'); 106 + if ($with_no_project) { 107 + $query->withAllProjects(array(ManiphestTaskOwner::PROJECT_NO_PROJECT)); 108 + } else { 109 + $project_phids = $saved->getParameter('allProjectPHIDs'); 110 + if ($project_phids) { 111 + $query->withAllProjects($project_phids); 112 + } 113 + } 114 + 115 + $any_project_phids = $saved->getParameter('anyProjectPHIDs'); 116 + if ($any_project_phids) { 117 + $query->withAnyProjects($any_project_phids); 118 + } 119 + 120 + $exclude_project_phids = $saved->getParameter('excludeProjectPHIDs'); 121 + if ($exclude_project_phids) { 122 + $query->withoutProjects($exclude_project_phids); 123 + } 124 + 125 + $user_project_phids = $saved->getParameter('userProjectPHIDs'); 126 + if ($user_project_phids) { 127 + $query->withAnyUserProjects($user_project_phids); 128 + } 129 + 85 130 return $query; 86 131 } 87 132 ··· 91 136 92 137 $assigned_phids = $saved->getParameter('assignedPHIDs', array()); 93 138 $author_phids = $saved->getParameter('authorPHIDs', array()); 139 + $all_project_phids = $saved->getParameter( 140 + 'allProjectPHIDs', 141 + array()); 142 + $any_project_phids = $saved->getParameter( 143 + 'anyProjectPHIDs', 144 + array()); 145 + $exclude_project_phids = $saved->getParameter( 146 + 'excludeProjectPHIDs', 147 + array()); 148 + $user_project_phids = $saved->getParameter( 149 + 'userProjectPHIDs', 150 + array()); 94 151 95 - $all_phids = array_merge($assigned_phids, $author_phids); 152 + $all_phids = array_merge( 153 + $assigned_phids, 154 + $author_phids, 155 + $all_project_phids, 156 + $any_project_phids, 157 + $exclude_project_phids, 158 + $user_project_phids); 96 159 97 160 if ($all_phids) { 98 161 $handles = id(new PhabricatorHandleQuery()) ··· 103 166 $handles = array(); 104 167 } 105 168 106 - $assigned_tokens = array_select_keys($handles, $assigned_phids); 107 - $assigned_tokens = mpull($assigned_tokens, 'getFullName', 'getPHID'); 108 - 109 - $author_tokens = array_select_keys($handles, $author_phids); 110 - $author_tokens = mpull($author_tokens, 'getFullName', 'getPHID'); 169 + $assigned_handles = array_select_keys($handles, $assigned_phids); 170 + $author_handles = array_select_keys($handles, $author_phids); 171 + $all_project_handles = array_select_keys($handles, $all_project_phids); 172 + $any_project_handles = array_select_keys($handles, $any_project_phids); 173 + $exclude_project_handles = array_select_keys( 174 + $handles, 175 + $exclude_project_phids); 176 + $user_project_handles = array_select_keys($handles, $user_project_phids); 111 177 112 178 $with_unassigned = $saved->getParameter('withUnassigned'); 179 + $with_no_projects = $saved->getParameter('withNoProject'); 113 180 114 181 $statuses = $saved->getParameter('statuses', array()); 115 182 $statuses = array_fuse($statuses); ··· 143 210 ->setDatasource('/typeahead/common/accounts/') 144 211 ->setName('assigned') 145 212 ->setLabel(pht('Assigned To')) 146 - ->setValue($assigned_tokens)) 213 + ->setValue($assigned_handles)) 147 214 ->appendChild( 148 215 id(new AphrontFormCheckboxControl()) 149 216 ->addCheckbox( ··· 153 220 $with_unassigned)) 154 221 ->appendChild( 155 222 id(new AphrontFormTokenizerControl()) 223 + ->setDatasource('/typeahead/common/projects/') 224 + ->setName('allProjects') 225 + ->setLabel(pht('In All Projects')) 226 + ->setValue($all_project_handles)) 227 + ->appendChild( 228 + id(new AphrontFormCheckboxControl()) 229 + ->addCheckbox( 230 + 'withNoProject', 231 + 1, 232 + pht('Show only tasks with no projects.'), 233 + $with_no_projects)) 234 + ->appendChild( 235 + id(new AphrontFormTokenizerControl()) 236 + ->setDatasource('/typeahead/common/projects/') 237 + ->setName('anyProjects') 238 + ->setLabel(pht('In Any Project')) 239 + ->setValue($any_project_handles)) 240 + ->appendChild( 241 + id(new AphrontFormTokenizerControl()) 242 + ->setDatasource('/typeahead/common/projects/') 243 + ->setName('excludeProjects') 244 + ->setLabel(pht('Not In Projects')) 245 + ->setValue($exclude_project_handles)) 246 + ->appendChild( 247 + id(new AphrontFormTokenizerControl()) 248 + ->setDatasource('/typeahead/common/accounts/') 249 + ->setName('userProjects') 250 + ->setLabel(pht('In Users\' Projects')) 251 + ->setValue($user_project_handles)) 252 + ->appendChild( 253 + id(new AphrontFormTokenizerControl()) 156 254 ->setDatasource('/typeahead/common/accounts/') 157 255 ->setName('authors') 158 256 ->setLabel(pht('Authors')) 159 - ->setValue($author_tokens)) 257 + ->setValue($author_handles)) 160 258 ->appendChild($status_control) 161 259 ->appendChild($priority_control) 162 260 ->appendChild( ··· 214 312 ->setParameter('statuses', array(ManiphestTaskStatus::STATUS_OPEN)); 215 313 case 'authored': 216 314 return $query 217 - ->setParameter('authorPHIDs', array($viewer_phid)) 218 - ->setParameter('statuses', array(ManiphestTaskStatus::STATUS_OPEN)); 315 + ->setParameter('authorPHIDs', array($viewer_phid)); 219 316 } 220 317 221 318 return parent::buildSavedQueryFromBuiltin($query_key);
+10
src/view/form/control/AphrontFormTokenizerControl.php
··· 35 35 $name = $this->getName(); 36 36 $values = nonempty($this->getValue(), array()); 37 37 38 + // TODO: Convert tokenizers to always take raw handles. For now, we 39 + // accept either a list of handles or a `map<phid, string>`. 40 + try { 41 + assert_instances_of($values, 'PhabricatorObjectHandle'); 42 + $values = mpull($values, 'getFullName', 'getPHID'); 43 + } catch (InvalidArgumentException $ex) { 44 + // Ignore this, just use the values as provided. 45 + } 46 + 47 + 38 48 if ($this->getID()) { 39 49 $id = $this->getID(); 40 50 } else {