Page MenuHomePhabricator

D7392.id16649.diff
No OneTemporary

D7392.id16649.diff

Index: src/__phutil_library_map__.php
===================================================================
--- src/__phutil_library_map__.php
+++ src/__phutil_library_map__.php
@@ -1297,6 +1297,7 @@
'PhabricatorFlagQuery' => 'applications/flag/query/PhabricatorFlagQuery.php',
'PhabricatorFlagSearchEngine' => 'applications/flag/query/PhabricatorFlagSearchEngine.php',
'PhabricatorFlagSelectControl' => 'applications/flag/view/PhabricatorFlagSelectControl.php',
+ 'PhabricatorFlaggableInterface' => 'applications/flag/interface/PhabricatorFlaggableInterface.php',
'PhabricatorFlagsUIEventListener' => 'applications/flag/events/PhabricatorFlagsUIEventListener.php',
'PhabricatorFormExample' => 'applications/uiexample/examples/PhabricatorFormExample.php',
'PhabricatorGarbageCollectorConfigOptions' => 'applications/config/option/PhabricatorGarbageCollectorConfigOptions.php',
@@ -2583,7 +2584,8 @@
0 => 'DifferentialDAO',
1 => 'PhabricatorTokenReceiverInterface',
2 => 'PhabricatorPolicyInterface',
- 3 => 'PhrequentTrackableInterface',
+ 3 => 'PhabricatorFlaggableInterface',
+ 4 => 'PhrequentTrackableInterface',
),
'DifferentialRevisionCommentListView' => 'AphrontView',
'DifferentialRevisionCommentView' => 'AphrontView',
@@ -2879,7 +2881,8 @@
'HeraldRule' =>
array(
0 => 'HeraldDAO',
- 1 => 'PhabricatorPolicyInterface',
+ 1 => 'PhabricatorFlaggableInterface',
+ 2 => 'PhabricatorPolicyInterface',
),
'HeraldRuleController' => 'HeraldController',
'HeraldRuleEdit' => 'HeraldDAO',
@@ -2994,8 +2997,9 @@
1 => 'PhabricatorMarkupInterface',
2 => 'PhabricatorPolicyInterface',
3 => 'PhabricatorTokenReceiverInterface',
- 4 => 'PhrequentTrackableInterface',
- 5 => 'PhabricatorCustomFieldInterface',
+ 4 => 'PhabricatorFlaggableInterface',
+ 5 => 'PhrequentTrackableInterface',
+ 6 => 'PhabricatorCustomFieldInterface',
),
'ManiphestTaskDescriptionPreviewController' => 'ManiphestController',
'ManiphestTaskDetailController' => 'ManiphestController',
@@ -3512,7 +3516,8 @@
0 => 'PhabricatorFileDAO',
1 => 'PhabricatorTokenReceiverInterface',
2 => 'PhabricatorSubscribableInterface',
- 3 => 'PhabricatorPolicyInterface',
+ 3 => 'PhabricatorFlaggableInterface',
+ 4 => 'PhabricatorPolicyInterface',
),
'PhabricatorFileCommentController' => 'PhabricatorFileController',
'PhabricatorFileComposeController' => 'PhabricatorFileController',
@@ -3527,7 +3532,8 @@
0 => 'PhabricatorFileDAO',
1 => 'PhabricatorSubscribableInterface',
2 => 'PhabricatorApplicationTransactionInterface',
- 3 => 'PhabricatorPolicyInterface',
+ 3 => 'PhabricatorFlaggableInterface',
+ 4 => 'PhabricatorPolicyInterface',
),
'PhabricatorFileInfoController' => 'PhabricatorFileController',
'PhabricatorFileLinkListView' => 'AphrontView',
@@ -3758,7 +3764,8 @@
0 => 'PhabricatorPasteDAO',
1 => 'PhabricatorSubscribableInterface',
2 => 'PhabricatorTokenReceiverInterface',
- 3 => 'PhabricatorPolicyInterface',
+ 3 => 'PhabricatorFlaggableInterface',
+ 4 => 'PhabricatorPolicyInterface',
),
'PhabricatorPasteCommentController' => 'PhabricatorPasteController',
'PhabricatorPasteConfigOptions' => 'PhabricatorApplicationConfigOptions',
@@ -3840,7 +3847,8 @@
'PhabricatorProject' =>
array(
0 => 'PhabricatorProjectDAO',
- 1 => 'PhabricatorPolicyInterface',
+ 1 => 'PhabricatorFlaggableInterface',
+ 2 => 'PhabricatorPolicyInterface',
),
'PhabricatorProjectBoardController' => 'PhabricatorProjectController',
'PhabricatorProjectColumn' =>
@@ -3896,7 +3904,8 @@
array(
0 => 'PhabricatorRepositoryDAO',
1 => 'PhabricatorPolicyInterface',
- 2 => 'PhabricatorMarkupInterface',
+ 2 => 'PhabricatorFlaggableInterface',
+ 3 => 'PhabricatorMarkupInterface',
),
'PhabricatorRepositoryArcanistProject' =>
array(
@@ -3912,7 +3921,8 @@
array(
0 => 'PhabricatorRepositoryDAO',
1 => 'PhabricatorPolicyInterface',
- 2 => 'PhabricatorTokenReceiverInterface',
+ 2 => 'PhabricatorFlaggableInterface',
+ 3 => 'PhabricatorTokenReceiverInterface',
),
'PhabricatorRepositoryCommitChangeParserWorker' => 'PhabricatorRepositoryCommitParserWorker',
'PhabricatorRepositoryCommitData' => 'PhabricatorRepositoryDAO',
@@ -4037,7 +4047,8 @@
0 => 'PhabricatorSlowvoteDAO',
1 => 'PhabricatorPolicyInterface',
2 => 'PhabricatorSubscribableInterface',
- 3 => 'PhabricatorTokenReceiverInterface',
+ 3 => 'PhabricatorFlaggableInterface',
+ 4 => 'PhabricatorTokenReceiverInterface',
),
'PhabricatorSlowvotePollController' => 'PhabricatorSlowvoteController',
'PhabricatorSlowvoteQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
@@ -4239,7 +4250,8 @@
'PhluxVariable' =>
array(
0 => 'PhluxDAO',
- 1 => 'PhabricatorPolicyInterface',
+ 1 => 'PhabricatorFlaggableInterface',
+ 2 => 'PhabricatorPolicyInterface',
),
'PhluxVariableEditor' => 'PhabricatorApplicationTransactionEditor',
'PhluxVariableQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
@@ -4272,7 +4284,8 @@
2 => 'PhabricatorPolicyInterface',
3 => 'PhabricatorSubscribableInterface',
4 => 'PhabricatorTokenReceiverInterface',
- 5 => 'PhabricatorApplicationTransactionInterface',
+ 5 => 'PhabricatorFlaggableInterface',
+ 6 => 'PhabricatorApplicationTransactionInterface',
),
'PholioMockCommentController' => 'PholioController',
'PholioMockEditController' => 'PholioController',
@@ -4386,7 +4399,8 @@
0 => 'PhrictionDAO',
1 => 'PhabricatorPolicyInterface',
2 => 'PhabricatorSubscribableInterface',
- 3 => 'PhabricatorTokenReceiverInterface',
+ 3 => 'PhabricatorFlaggableInterface',
+ 4 => 'PhabricatorTokenReceiverInterface',
),
'PhrictionDocumentController' => 'PhrictionController',
'PhrictionDocumentEditor' => 'PhabricatorEditor',
@@ -4414,8 +4428,9 @@
1 => 'PhabricatorMarkupInterface',
2 => 'PonderVotableInterface',
3 => 'PhabricatorPolicyInterface',
- 4 => 'PhabricatorSubscribableInterface',
- 5 => 'PhabricatorTokenReceiverInterface',
+ 4 => 'PhabricatorFlaggableInterface',
+ 5 => 'PhabricatorSubscribableInterface',
+ 6 => 'PhabricatorTokenReceiverInterface',
),
'PonderAnswerCommentController' => 'PonderController',
'PonderAnswerEditController' => 'PonderController',
@@ -4443,8 +4458,9 @@
1 => 'PhabricatorMarkupInterface',
2 => 'PonderVotableInterface',
3 => 'PhabricatorSubscribableInterface',
- 4 => 'PhabricatorPolicyInterface',
- 5 => 'PhabricatorTokenReceiverInterface',
+ 4 => 'PhabricatorFlaggableInterface',
+ 5 => 'PhabricatorPolicyInterface',
+ 6 => 'PhabricatorTokenReceiverInterface',
),
'PonderQuestionCommentController' => 'PonderController',
'PonderQuestionEditController' => 'PonderController',
Index: src/applications/differential/storage/DifferentialRevision.php
===================================================================
--- src/applications/differential/storage/DifferentialRevision.php
+++ src/applications/differential/storage/DifferentialRevision.php
@@ -4,6 +4,7 @@
implements
PhabricatorTokenReceiverInterface,
PhabricatorPolicyInterface,
+ PhabricatorFlaggableInterface,
PhrequentTrackableInterface {
protected $title = '';
Index: src/applications/files/storage/PhabricatorFile.php
===================================================================
--- src/applications/files/storage/PhabricatorFile.php
+++ src/applications/files/storage/PhabricatorFile.php
@@ -7,6 +7,7 @@
implements
PhabricatorTokenReceiverInterface,
PhabricatorSubscribableInterface,
+ PhabricatorFlaggableInterface,
PhabricatorPolicyInterface {
const STORAGE_FORMAT_RAW = 'raw';
Index: src/applications/flag/events/PhabricatorFlagsUIEventListener.php
===================================================================
--- src/applications/flag/events/PhabricatorFlagsUIEventListener.php
+++ src/applications/flag/events/PhabricatorFlagsUIEventListener.php
@@ -24,10 +24,7 @@
return;
}
- if (($object instanceof PhabricatorUser)) {
- // Although there's no real reason not to let you flag users, it also
- // makes less conceptual sense than flaging other types of objects. For
- // now, don't allow it.
+ if (!($object instanceof PhabricatorFlaggableInterface)) {
return;
}
Index: src/applications/flag/interface/PhabricatorFlaggableInterface.php
===================================================================
--- /dev/null
+++ src/applications/flag/interface/PhabricatorFlaggableInterface.php
@@ -0,0 +1,5 @@
+<?php
+
+interface PhabricatorFlaggableInterface {
+
+}
Index: src/applications/flag/query/PhabricatorFlagSearchEngine.php
===================================================================
--- src/applications/flag/query/PhabricatorFlagSearchEngine.php
+++ src/applications/flag/query/PhabricatorFlagSearchEngine.php
@@ -7,6 +7,7 @@
$saved = new PhabricatorSavedQuery();
$saved->setParameter('colors', $request->getArr('colors'));
$saved->setParameter('group', $request->getStr('group'));
+ $saved->setParameter('objectFilter', $request->getStr('objectFilter'));
return $saved;
}
@@ -25,6 +26,12 @@
$query->setGroupBy($group);
}
+ $object_filter = $saved->getParameter('objectFilter');
+ $objects = $this->getObjectFilterOptions();
+ if ($object_filter && isset($objects[$object_filter])) {
+ $query->setObjectFilter($object_filter);
+ }
+
return $query;
}
@@ -43,8 +50,12 @@
->setName('group')
->setLabel(pht('Group By'))
->setValue($saved_query->getParameter('group'))
- ->setOptions($this->getGroupOptions()));
-
+ ->setOptions($this->getGroupOptions()))
+ ->appendChild(
+ id(new AphrontFormSelectControl())
+ ->setName('objectFilter')
+ ->setValue($saved_query->getParameter('objectFilter'))
+ ->setOptions($this->getObjectFilterOptions()));
}
protected function getURI($path) {
@@ -79,4 +90,20 @@
);
}
+ private function getObjectFilterOptions() {
+ $objects = id(new PhutilSymbolLoader())
+ ->setAncestorClass('PhabricatorFlaggableInterface')
+ ->loadObjects();
+ $options = array(
+ 0 => 'All Objects');
+ foreach ($objects as $object) {
+ phlog($object);
+ }
+
+ // TODO - now that we have all the possible types of objects that can be
+ // flagged, how do we "bridge over to the phid types"....?
+
+ return $options;
+ }
+
}
Index: src/applications/herald/storage/HeraldRule.php
===================================================================
--- src/applications/herald/storage/HeraldRule.php
+++ src/applications/herald/storage/HeraldRule.php
@@ -1,7 +1,9 @@
<?php
final class HeraldRule extends HeraldDAO
- implements PhabricatorPolicyInterface {
+ implements
+ PhabricatorFlaggableInterface,
+ PhabricatorPolicyInterface {
const TABLE_RULE_APPLIED = 'herald_ruleapplied';
Index: src/applications/macro/storage/PhabricatorFileImageMacro.php
===================================================================
--- src/applications/macro/storage/PhabricatorFileImageMacro.php
+++ src/applications/macro/storage/PhabricatorFileImageMacro.php
@@ -4,6 +4,7 @@
implements
PhabricatorSubscribableInterface,
PhabricatorApplicationTransactionInterface,
+ PhabricatorFlaggableInterface,
PhabricatorPolicyInterface {
protected $authorPHID;
Index: src/applications/maniphest/storage/ManiphestTask.php
===================================================================
--- src/applications/maniphest/storage/ManiphestTask.php
+++ src/applications/maniphest/storage/ManiphestTask.php
@@ -5,6 +5,7 @@
PhabricatorMarkupInterface,
PhabricatorPolicyInterface,
PhabricatorTokenReceiverInterface,
+ PhabricatorFlaggableInterface,
PhrequentTrackableInterface,
PhabricatorCustomFieldInterface {
Index: src/applications/paste/storage/PhabricatorPaste.php
===================================================================
--- src/applications/paste/storage/PhabricatorPaste.php
+++ src/applications/paste/storage/PhabricatorPaste.php
@@ -4,6 +4,7 @@
implements
PhabricatorSubscribableInterface,
PhabricatorTokenReceiverInterface,
+ PhabricatorFlaggableInterface,
PhabricatorPolicyInterface {
protected $title;
Index: src/applications/phlux/storage/PhluxVariable.php
===================================================================
--- src/applications/phlux/storage/PhluxVariable.php
+++ src/applications/phlux/storage/PhluxVariable.php
@@ -1,7 +1,9 @@
<?php
final class PhluxVariable extends PhluxDAO
- implements PhabricatorPolicyInterface {
+ implements
+ PhabricatorFlaggableInterface,
+ PhabricatorPolicyInterface {
protected $variableKey;
protected $variableValue;
Index: src/applications/pholio/storage/PholioMock.php
===================================================================
--- src/applications/pholio/storage/PholioMock.php
+++ src/applications/pholio/storage/PholioMock.php
@@ -9,6 +9,7 @@
PhabricatorPolicyInterface,
PhabricatorSubscribableInterface,
PhabricatorTokenReceiverInterface,
+ PhabricatorFlaggableInterface,
PhabricatorApplicationTransactionInterface {
const MARKUP_FIELD_DESCRIPTION = 'markup:description';
Index: src/applications/phriction/storage/PhrictionDocument.php
===================================================================
--- src/applications/phriction/storage/PhrictionDocument.php
+++ src/applications/phriction/storage/PhrictionDocument.php
@@ -7,6 +7,7 @@
implements
PhabricatorPolicyInterface,
PhabricatorSubscribableInterface,
+ PhabricatorFlaggableInterface,
PhabricatorTokenReceiverInterface {
protected $slug;
Index: src/applications/ponder/storage/PonderAnswer.php
===================================================================
--- src/applications/ponder/storage/PonderAnswer.php
+++ src/applications/ponder/storage/PonderAnswer.php
@@ -5,6 +5,7 @@
PhabricatorMarkupInterface,
PonderVotableInterface,
PhabricatorPolicyInterface,
+ PhabricatorFlaggableInterface,
PhabricatorSubscribableInterface,
PhabricatorTokenReceiverInterface {
Index: src/applications/ponder/storage/PonderQuestion.php
===================================================================
--- src/applications/ponder/storage/PonderQuestion.php
+++ src/applications/ponder/storage/PonderQuestion.php
@@ -5,6 +5,7 @@
PhabricatorMarkupInterface,
PonderVotableInterface,
PhabricatorSubscribableInterface,
+ PhabricatorFlaggableInterface,
PhabricatorPolicyInterface,
PhabricatorTokenReceiverInterface {
Index: src/applications/project/storage/PhabricatorProject.php
===================================================================
--- src/applications/project/storage/PhabricatorProject.php
+++ src/applications/project/storage/PhabricatorProject.php
@@ -1,7 +1,9 @@
<?php
final class PhabricatorProject extends PhabricatorProjectDAO
- implements PhabricatorPolicyInterface {
+ implements
+ PhabricatorFlaggableInterface,
+ PhabricatorPolicyInterface {
protected $name;
protected $status = PhabricatorProjectStatus::STATUS_ACTIVE;
Index: src/applications/repository/storage/PhabricatorRepository.php
===================================================================
--- src/applications/repository/storage/PhabricatorRepository.php
+++ src/applications/repository/storage/PhabricatorRepository.php
@@ -6,6 +6,7 @@
final class PhabricatorRepository extends PhabricatorRepositoryDAO
implements
PhabricatorPolicyInterface,
+ PhabricatorFlaggableInterface,
PhabricatorMarkupInterface {
/**
Index: src/applications/repository/storage/PhabricatorRepositoryCommit.php
===================================================================
--- src/applications/repository/storage/PhabricatorRepositoryCommit.php
+++ src/applications/repository/storage/PhabricatorRepositoryCommit.php
@@ -4,6 +4,7 @@
extends PhabricatorRepositoryDAO
implements
PhabricatorPolicyInterface,
+ PhabricatorFlaggableInterface,
PhabricatorTokenReceiverInterface {
protected $repositoryID;
Index: src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
===================================================================
--- src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
+++ src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
@@ -7,6 +7,7 @@
implements
PhabricatorPolicyInterface,
PhabricatorSubscribableInterface,
+ PhabricatorFlaggableInterface,
PhabricatorTokenReceiverInterface {
const RESPONSES_VISIBLE = 0;

File Metadata

Mime Type
text/plain
Expires
Mon, Jun 24, 3:10 PM (5 d, 8 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6305079
Default Alt Text
D7392.id16649.diff (16 KB)

Event Timeline