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

Add filter by object ability to flag query

Summary: See title. Fixes T1809.

Test Plan:
verified each type that has flaggable interface still can be flagged

verified that new custom query filter works

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Maniphest Tasks: T1809

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

+101 -27
+34 -18
src/__phutil_library_map__.php
··· 1299 1299 'PhabricatorFlagQuery' => 'applications/flag/query/PhabricatorFlagQuery.php', 1300 1300 'PhabricatorFlagSearchEngine' => 'applications/flag/query/PhabricatorFlagSearchEngine.php', 1301 1301 'PhabricatorFlagSelectControl' => 'applications/flag/view/PhabricatorFlagSelectControl.php', 1302 + 'PhabricatorFlaggableInterface' => 'applications/flag/interface/PhabricatorFlaggableInterface.php', 1302 1303 'PhabricatorFlagsUIEventListener' => 'applications/flag/events/PhabricatorFlagsUIEventListener.php', 1303 1304 'PhabricatorFormExample' => 'applications/uiexample/examples/PhabricatorFormExample.php', 1304 1305 'PhabricatorGarbageCollectorConfigOptions' => 'applications/config/option/PhabricatorGarbageCollectorConfigOptions.php', ··· 2587 2588 0 => 'DifferentialDAO', 2588 2589 1 => 'PhabricatorTokenReceiverInterface', 2589 2590 2 => 'PhabricatorPolicyInterface', 2590 - 3 => 'PhrequentTrackableInterface', 2591 + 3 => 'PhabricatorFlaggableInterface', 2592 + 4 => 'PhrequentTrackableInterface', 2591 2593 ), 2592 2594 'DifferentialRevisionCommentListView' => 'AphrontView', 2593 2595 'DifferentialRevisionCommentView' => 'AphrontView', ··· 2883 2885 'HeraldRule' => 2884 2886 array( 2885 2887 0 => 'HeraldDAO', 2886 - 1 => 'PhabricatorPolicyInterface', 2888 + 1 => 'PhabricatorFlaggableInterface', 2889 + 2 => 'PhabricatorPolicyInterface', 2887 2890 ), 2888 2891 'HeraldRuleController' => 'HeraldController', 2889 2892 'HeraldRuleEdit' => 'HeraldDAO', ··· 2998 3001 1 => 'PhabricatorMarkupInterface', 2999 3002 2 => 'PhabricatorPolicyInterface', 3000 3003 3 => 'PhabricatorTokenReceiverInterface', 3001 - 4 => 'PhrequentTrackableInterface', 3002 - 5 => 'PhabricatorCustomFieldInterface', 3004 + 4 => 'PhabricatorFlaggableInterface', 3005 + 5 => 'PhrequentTrackableInterface', 3006 + 6 => 'PhabricatorCustomFieldInterface', 3003 3007 ), 3004 3008 'ManiphestTaskDescriptionPreviewController' => 'ManiphestController', 3005 3009 'ManiphestTaskDetailController' => 'ManiphestController', ··· 3518 3522 0 => 'PhabricatorFileDAO', 3519 3523 1 => 'PhabricatorTokenReceiverInterface', 3520 3524 2 => 'PhabricatorSubscribableInterface', 3521 - 3 => 'PhabricatorPolicyInterface', 3525 + 3 => 'PhabricatorFlaggableInterface', 3526 + 4 => 'PhabricatorPolicyInterface', 3522 3527 ), 3523 3528 'PhabricatorFileCommentController' => 'PhabricatorFileController', 3524 3529 'PhabricatorFileComposeController' => 'PhabricatorFileController', ··· 3533 3538 0 => 'PhabricatorFileDAO', 3534 3539 1 => 'PhabricatorSubscribableInterface', 3535 3540 2 => 'PhabricatorApplicationTransactionInterface', 3536 - 3 => 'PhabricatorPolicyInterface', 3541 + 3 => 'PhabricatorFlaggableInterface', 3542 + 4 => 'PhabricatorPolicyInterface', 3537 3543 ), 3538 3544 'PhabricatorFileInfoController' => 'PhabricatorFileController', 3539 3545 'PhabricatorFileLinkListView' => 'AphrontView', ··· 3764 3770 0 => 'PhabricatorPasteDAO', 3765 3771 1 => 'PhabricatorSubscribableInterface', 3766 3772 2 => 'PhabricatorTokenReceiverInterface', 3767 - 3 => 'PhabricatorPolicyInterface', 3773 + 3 => 'PhabricatorFlaggableInterface', 3774 + 4 => 'PhabricatorPolicyInterface', 3768 3775 ), 3769 3776 'PhabricatorPasteCommentController' => 'PhabricatorPasteController', 3770 3777 'PhabricatorPasteConfigOptions' => 'PhabricatorApplicationConfigOptions', ··· 3846 3853 'PhabricatorProject' => 3847 3854 array( 3848 3855 0 => 'PhabricatorProjectDAO', 3849 - 1 => 'PhabricatorPolicyInterface', 3856 + 1 => 'PhabricatorFlaggableInterface', 3857 + 2 => 'PhabricatorPolicyInterface', 3850 3858 ), 3851 3859 'PhabricatorProjectBoardController' => 'PhabricatorProjectController', 3852 3860 'PhabricatorProjectColumn' => ··· 3904 3912 array( 3905 3913 0 => 'PhabricatorRepositoryDAO', 3906 3914 1 => 'PhabricatorPolicyInterface', 3907 - 2 => 'PhabricatorMarkupInterface', 3915 + 2 => 'PhabricatorFlaggableInterface', 3916 + 3 => 'PhabricatorMarkupInterface', 3908 3917 ), 3909 3918 'PhabricatorRepositoryArcanistProject' => 3910 3919 array( ··· 3920 3929 array( 3921 3930 0 => 'PhabricatorRepositoryDAO', 3922 3931 1 => 'PhabricatorPolicyInterface', 3923 - 2 => 'PhabricatorTokenReceiverInterface', 3932 + 2 => 'PhabricatorFlaggableInterface', 3933 + 3 => 'PhabricatorTokenReceiverInterface', 3924 3934 ), 3925 3935 'PhabricatorRepositoryCommitChangeParserWorker' => 'PhabricatorRepositoryCommitParserWorker', 3926 3936 'PhabricatorRepositoryCommitData' => 'PhabricatorRepositoryDAO', ··· 4045 4055 0 => 'PhabricatorSlowvoteDAO', 4046 4056 1 => 'PhabricatorPolicyInterface', 4047 4057 2 => 'PhabricatorSubscribableInterface', 4048 - 3 => 'PhabricatorTokenReceiverInterface', 4058 + 3 => 'PhabricatorFlaggableInterface', 4059 + 4 => 'PhabricatorTokenReceiverInterface', 4049 4060 ), 4050 4061 'PhabricatorSlowvotePollController' => 'PhabricatorSlowvoteController', 4051 4062 'PhabricatorSlowvoteQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', ··· 4247 4258 'PhluxVariable' => 4248 4259 array( 4249 4260 0 => 'PhluxDAO', 4250 - 1 => 'PhabricatorPolicyInterface', 4261 + 1 => 'PhabricatorFlaggableInterface', 4262 + 2 => 'PhabricatorPolicyInterface', 4251 4263 ), 4252 4264 'PhluxVariableEditor' => 'PhabricatorApplicationTransactionEditor', 4253 4265 'PhluxVariableQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', ··· 4280 4292 2 => 'PhabricatorPolicyInterface', 4281 4293 3 => 'PhabricatorSubscribableInterface', 4282 4294 4 => 'PhabricatorTokenReceiverInterface', 4283 - 5 => 'PhabricatorApplicationTransactionInterface', 4295 + 5 => 'PhabricatorFlaggableInterface', 4296 + 6 => 'PhabricatorApplicationTransactionInterface', 4284 4297 ), 4285 4298 'PholioMockCommentController' => 'PholioController', 4286 4299 'PholioMockEditController' => 'PholioController', ··· 4394 4407 0 => 'PhrictionDAO', 4395 4408 1 => 'PhabricatorPolicyInterface', 4396 4409 2 => 'PhabricatorSubscribableInterface', 4397 - 3 => 'PhabricatorTokenReceiverInterface', 4410 + 3 => 'PhabricatorFlaggableInterface', 4411 + 4 => 'PhabricatorTokenReceiverInterface', 4398 4412 ), 4399 4413 'PhrictionDocumentController' => 'PhrictionController', 4400 4414 'PhrictionDocumentEditor' => 'PhabricatorEditor', ··· 4422 4436 1 => 'PhabricatorMarkupInterface', 4423 4437 2 => 'PonderVotableInterface', 4424 4438 3 => 'PhabricatorPolicyInterface', 4425 - 4 => 'PhabricatorSubscribableInterface', 4426 - 5 => 'PhabricatorTokenReceiverInterface', 4439 + 4 => 'PhabricatorFlaggableInterface', 4440 + 5 => 'PhabricatorSubscribableInterface', 4441 + 6 => 'PhabricatorTokenReceiverInterface', 4427 4442 ), 4428 4443 'PonderAnswerCommentController' => 'PonderController', 4429 4444 'PonderAnswerEditController' => 'PonderController', ··· 4451 4466 1 => 'PhabricatorMarkupInterface', 4452 4467 2 => 'PonderVotableInterface', 4453 4468 3 => 'PhabricatorSubscribableInterface', 4454 - 4 => 'PhabricatorPolicyInterface', 4455 - 5 => 'PhabricatorTokenReceiverInterface', 4469 + 4 => 'PhabricatorFlaggableInterface', 4470 + 5 => 'PhabricatorPolicyInterface', 4471 + 6 => 'PhabricatorTokenReceiverInterface', 4456 4472 ), 4457 4473 'PonderQuestionCommentController' => 'PonderController', 4458 4474 'PonderQuestionEditController' => 'PonderController',
+1
src/applications/differential/storage/DifferentialRevision.php
··· 4 4 implements 5 5 PhabricatorTokenReceiverInterface, 6 6 PhabricatorPolicyInterface, 7 + PhabricatorFlaggableInterface, 7 8 PhrequentTrackableInterface { 8 9 9 10 protected $title = '';
+1
src/applications/files/storage/PhabricatorFile.php
··· 7 7 implements 8 8 PhabricatorTokenReceiverInterface, 9 9 PhabricatorSubscribableInterface, 10 + PhabricatorFlaggableInterface, 10 11 PhabricatorPolicyInterface { 11 12 12 13 const STORAGE_FORMAT_RAW = 'raw';
+1 -4
src/applications/flag/events/PhabricatorFlagsUIEventListener.php
··· 24 24 return; 25 25 } 26 26 27 - if (($object instanceof PhabricatorUser)) { 28 - // Although there's no real reason not to let you flag users, it also 29 - // makes less conceptual sense than flaging other types of objects. For 30 - // now, don't allow it. 27 + if (!($object instanceof PhabricatorFlaggableInterface)) { 31 28 return; 32 29 } 33 30
+7
src/applications/flag/interface/PhabricatorFlaggableInterface.php
··· 1 + <?php 2 + 3 + interface PhabricatorFlaggableInterface { 4 + 5 + public function getPHID(); 6 + 7 + }
+38 -2
src/applications/flag/query/PhabricatorFlagSearchEngine.php
··· 7 7 $saved = new PhabricatorSavedQuery(); 8 8 $saved->setParameter('colors', $request->getArr('colors')); 9 9 $saved->setParameter('group', $request->getStr('group')); 10 + $saved->setParameter('objectFilter', $request->getStr('objectFilter')); 10 11 return $saved; 11 12 } 12 13 ··· 25 26 $query->setGroupBy($group); 26 27 } 27 28 29 + $object_filter = $saved->getParameter('objectFilter'); 30 + $objects = $this->getObjectFilterOptions(); 31 + if ($object_filter && isset($objects[$object_filter])) { 32 + $query->withTypes(array($object_filter)); 33 + } 34 + 28 35 return $query; 29 36 } 30 37 ··· 43 50 ->setName('group') 44 51 ->setLabel(pht('Group By')) 45 52 ->setValue($saved_query->getParameter('group')) 46 - ->setOptions($this->getGroupOptions())); 47 - 53 + ->setOptions($this->getGroupOptions())) 54 + ->appendChild( 55 + id(new AphrontFormSelectControl()) 56 + ->setName('objectFilter') 57 + ->setLabel(pht('Object Type')) 58 + ->setValue($saved_query->getParameter('objectFilter')) 59 + ->setOptions($this->getObjectFilterOptions())); 48 60 } 49 61 50 62 protected function getURI($path) { ··· 77 89 PhabricatorFlagQuery::GROUP_NONE => pht('None'), 78 90 PhabricatorFlagQuery::GROUP_COLOR => pht('Color'), 79 91 ); 92 + } 93 + 94 + private function getObjectFilterOptions() { 95 + $objects = id(new PhutilSymbolLoader()) 96 + ->setAncestorClass('PhabricatorFlaggableInterface') 97 + ->loadObjects(); 98 + $all_types = PhabricatorPHIDType::getAllTypes(); 99 + $options = array(); 100 + foreach ($objects as $object) { 101 + $phid = $object->generatePHID(); 102 + $phid_type = phid_get_type($phid); 103 + $type_object = idx($all_types, $phid_type); 104 + if ($type_object) { 105 + $options[$phid_type] = $type_object->getTypeName(); 106 + } 107 + } 108 + // sort it alphabetically... 109 + asort($options); 110 + $default_option = array( 111 + 0 => 'All Objects'); 112 + // ...and stick the default option on front 113 + $options = array_merge($default_option, $options); 114 + 115 + return $options; 80 116 } 81 117 82 118 }
+3 -1
src/applications/herald/storage/HeraldRule.php
··· 1 1 <?php 2 2 3 3 final class HeraldRule extends HeraldDAO 4 - implements PhabricatorPolicyInterface { 4 + implements 5 + PhabricatorFlaggableInterface, 6 + PhabricatorPolicyInterface { 5 7 6 8 const TABLE_RULE_APPLIED = 'herald_ruleapplied'; 7 9
+1
src/applications/macro/storage/PhabricatorFileImageMacro.php
··· 4 4 implements 5 5 PhabricatorSubscribableInterface, 6 6 PhabricatorApplicationTransactionInterface, 7 + PhabricatorFlaggableInterface, 7 8 PhabricatorPolicyInterface { 8 9 9 10 protected $authorPHID;
+1
src/applications/maniphest/storage/ManiphestTask.php
··· 5 5 PhabricatorMarkupInterface, 6 6 PhabricatorPolicyInterface, 7 7 PhabricatorTokenReceiverInterface, 8 + PhabricatorFlaggableInterface, 8 9 PhrequentTrackableInterface, 9 10 PhabricatorCustomFieldInterface { 10 11
+1
src/applications/paste/storage/PhabricatorPaste.php
··· 4 4 implements 5 5 PhabricatorSubscribableInterface, 6 6 PhabricatorTokenReceiverInterface, 7 + PhabricatorFlaggableInterface, 7 8 PhabricatorPolicyInterface { 8 9 9 10 protected $title;
+3 -1
src/applications/phlux/storage/PhluxVariable.php
··· 1 1 <?php 2 2 3 3 final class PhluxVariable extends PhluxDAO 4 - implements PhabricatorPolicyInterface { 4 + implements 5 + PhabricatorFlaggableInterface, 6 + PhabricatorPolicyInterface { 5 7 6 8 protected $variableKey; 7 9 protected $variableValue;
+1
src/applications/pholio/storage/PholioMock.php
··· 9 9 PhabricatorPolicyInterface, 10 10 PhabricatorSubscribableInterface, 11 11 PhabricatorTokenReceiverInterface, 12 + PhabricatorFlaggableInterface, 12 13 PhabricatorApplicationTransactionInterface { 13 14 14 15 const MARKUP_FIELD_DESCRIPTION = 'markup:description';
+1
src/applications/phriction/storage/PhrictionDocument.php
··· 7 7 implements 8 8 PhabricatorPolicyInterface, 9 9 PhabricatorSubscribableInterface, 10 + PhabricatorFlaggableInterface, 10 11 PhabricatorTokenReceiverInterface { 11 12 12 13 protected $slug;
+1
src/applications/ponder/storage/PonderAnswer.php
··· 5 5 PhabricatorMarkupInterface, 6 6 PonderVotableInterface, 7 7 PhabricatorPolicyInterface, 8 + PhabricatorFlaggableInterface, 8 9 PhabricatorSubscribableInterface, 9 10 PhabricatorTokenReceiverInterface { 10 11
+1
src/applications/ponder/storage/PonderQuestion.php
··· 5 5 PhabricatorMarkupInterface, 6 6 PonderVotableInterface, 7 7 PhabricatorSubscribableInterface, 8 + PhabricatorFlaggableInterface, 8 9 PhabricatorPolicyInterface, 9 10 PhabricatorTokenReceiverInterface { 10 11
+3 -1
src/applications/project/storage/PhabricatorProject.php
··· 1 1 <?php 2 2 3 3 final class PhabricatorProject extends PhabricatorProjectDAO 4 - implements PhabricatorPolicyInterface { 4 + implements 5 + PhabricatorFlaggableInterface, 6 + PhabricatorPolicyInterface { 5 7 6 8 protected $name; 7 9 protected $status = PhabricatorProjectStatus::STATUS_ACTIVE;
+1
src/applications/repository/storage/PhabricatorRepository.php
··· 6 6 final class PhabricatorRepository extends PhabricatorRepositoryDAO 7 7 implements 8 8 PhabricatorPolicyInterface, 9 + PhabricatorFlaggableInterface, 9 10 PhabricatorMarkupInterface { 10 11 11 12 /**
+1
src/applications/repository/storage/PhabricatorRepositoryCommit.php
··· 4 4 extends PhabricatorRepositoryDAO 5 5 implements 6 6 PhabricatorPolicyInterface, 7 + PhabricatorFlaggableInterface, 7 8 PhabricatorTokenReceiverInterface { 8 9 9 10 protected $repositoryID;
+1
src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
··· 7 7 implements 8 8 PhabricatorPolicyInterface, 9 9 PhabricatorSubscribableInterface, 10 + PhabricatorFlaggableInterface, 10 11 PhabricatorTokenReceiverInterface { 11 12 12 13 const RESPONSES_VISIBLE = 0;