@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 filtering Differential overviews by other participants

Summary:
This is useful for writing feedback - what did I work on with someone?
This creates `AND IN (...)` and not `AND AND AND` if more participants are specified.
User may not expect it but whatever, it works the same for the most common case of 1 extra participant.
It would be nice to have this also for other filters but it would by way harder.

Test Plan: Displayed my revisions with some specific reviewer and some elses revisions with me as reviewer.

Reviewers: epriestley

Reviewed By: epriestley

CC: wez, aran, Korvin

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

vrana d04bc074 c59aeb22

+42 -5
+42 -5
src/applications/differential/controller/DifferentialRevisionListController.php
··· 24 24 'status' => $request->getStr('status'), 25 25 'order' => $request->getStr('order'), 26 26 )); 27 + $params['participants'] = $request->getArr('participants'); 27 28 28 29 $default_filter = ($viewer_is_anonymous ? 'all' : 'active'); 29 30 $filters = $this->getFilters(); ··· 105 106 'This filter requires that a user be specified above.'); 106 107 $panels[] = $warning; 107 108 } else { 108 - $query = $this->buildQuery($this->filter, $params['view_users']); 109 + $query = $this->buildQuery($this->filter, $params); 109 110 110 111 $pager = null; 111 112 if ($this->getFilterAllowsPaging($this->filter)) { ··· 264 265 private function getFilterControls($filter) { 265 266 static $controls = array( 266 267 'active' => array('phid'), 267 - 'revisions' => array('phid', 'status', 'order'), 268 - 'reviews' => array('phid', 'status', 'order'), 268 + 'revisions' => array('phid', 'participants', 'status', 'order'), 269 + 'reviews' => array('phid', 'participants', 'status', 'order'), 269 270 'subscribed' => array('subscriber', 'status', 'order'), 270 271 'drafts' => array('phid', 'status', 'order'), 271 272 'all' => array('status', 'order'), ··· 276 277 return $controls[$filter]; 277 278 } 278 279 279 - private function buildQuery($filter, array $user_phids) { 280 + private function buildQuery($filter, array $params) { 281 + $user_phids = $params['view_users']; 280 282 $query = new DifferentialRevisionQuery(); 281 283 282 284 $query->needRelationships(true); ··· 289 291 break; 290 292 case 'revisions': 291 293 $query->withAuthors($user_phids); 294 + $query->withReviewers($params['participants']); 292 295 break; 293 296 case 'reviews': 294 297 $query->withReviewers($user_phids); 298 + $query->withAuthors($params['participants']); 295 299 break; 296 300 case 'subscribed': 297 301 $query->withSubscribers($user_phids); ··· 313 317 PhutilURI $uri, 314 318 array $params) { 315 319 assert_instances_of($handles, 'PhabricatorObjectHandle'); 320 + 316 321 switch ($control) { 317 322 case 'subscriber': 318 323 case 'phid': ··· 325 330 $label = 'View Subscribers'; 326 331 } else { 327 332 $source = '/typeahead/common/accounts/'; 328 - $label = 'View Users'; 333 + switch ($this->filter) { 334 + case 'revisions': 335 + $label = 'Authors'; 336 + break; 337 + case 'reviews': 338 + $label = 'Reviewers'; 339 + break; 340 + default: 341 + $label = 'View Users'; 342 + break; 343 + } 329 344 } 330 345 331 346 return id(new AphrontFormTokenizerControl()) ··· 333 348 ->setLabel($label) 334 349 ->setName('view_users') 335 350 ->setValue($value); 351 + 352 + case 'participants': 353 + switch ($this->filter) { 354 + case 'revisions': 355 + $label = 'Reviewers'; 356 + break; 357 + case 'reviews': 358 + $label = 'Authors'; 359 + break; 360 + } 361 + $value = mpull( 362 + array_select_keys($handles, $params['participants']), 363 + 'getFullName'); 364 + return id(new AphrontFormTokenizerControl()) 365 + ->setDatasource('/typeahead/common/allmailable/') 366 + ->setLabel($label) 367 + ->setName('participants') 368 + ->setValue($value); 369 + 336 370 case 'status': 337 371 return id(new AphrontFormToggleButtonsControl()) 338 372 ->setLabel('Status') ··· 345 379 'closed' => pht('Closed'), 346 380 'abandoned' => 'Abandoned', 347 381 )); 382 + 348 383 case 'order': 349 384 return id(new AphrontFormToggleButtonsControl()) 350 385 ->setLabel('Order') ··· 355 390 'modified' => 'Updated', 356 391 'created' => 'Created', 357 392 )); 393 + 358 394 default: 359 395 throw new Exception("Unknown control '{$control}'!"); 360 396 } ··· 364 400 switch ($control) { 365 401 case 'phid': 366 402 case 'subscriber': 403 + case 'participants': 367 404 // Already applied by query construction. 368 405 break; 369 406 case 'status':