Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F89560
D7392.id16677.diff
All Users
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
17 KB
Referenced Files
None
Subscribers
None
D7392.id16677.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/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',
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -4,6 +4,7 @@
implements
PhabricatorTokenReceiverInterface,
PhabricatorPolicyInterface,
+ PhabricatorFlaggableInterface,
PhrequentTrackableInterface {
protected $title = '';
diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php
--- a/src/applications/files/storage/PhabricatorFile.php
+++ b/src/applications/files/storage/PhabricatorFile.php
@@ -7,6 +7,7 @@
implements
PhabricatorTokenReceiverInterface,
PhabricatorSubscribableInterface,
+ PhabricatorFlaggableInterface,
PhabricatorPolicyInterface {
const STORAGE_FORMAT_RAW = 'raw';
diff --git a/src/applications/flag/events/PhabricatorFlagsUIEventListener.php b/src/applications/flag/events/PhabricatorFlagsUIEventListener.php
--- a/src/applications/flag/events/PhabricatorFlagsUIEventListener.php
+++ b/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;
}
diff --git a/src/applications/flag/interface/PhabricatorFlaggableInterface.php b/src/applications/flag/interface/PhabricatorFlaggableInterface.php
new file mode 100644
--- /dev/null
+++ b/src/applications/flag/interface/PhabricatorFlaggableInterface.php
@@ -0,0 +1,7 @@
+<?php
+
+interface PhabricatorFlaggableInterface {
+
+ public function getPHID();
+
+}
diff --git a/src/applications/flag/query/PhabricatorFlagSearchEngine.php b/src/applications/flag/query/PhabricatorFlagSearchEngine.php
--- a/src/applications/flag/query/PhabricatorFlagSearchEngine.php
+++ b/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->withTypes(array($object_filter));
+ }
+
return $query;
}
@@ -43,8 +50,13 @@
->setName('group')
->setLabel(pht('Group By'))
->setValue($saved_query->getParameter('group'))
- ->setOptions($this->getGroupOptions()));
-
+ ->setOptions($this->getGroupOptions()))
+ ->appendChild(
+ id(new AphrontFormSelectControl())
+ ->setName('objectFilter')
+ ->setLabel(pht('Object Type'))
+ ->setValue($saved_query->getParameter('objectFilter'))
+ ->setOptions($this->getObjectFilterOptions()));
}
protected function getURI($path) {
@@ -79,4 +91,28 @@
);
}
+ private function getObjectFilterOptions() {
+ $objects = id(new PhutilSymbolLoader())
+ ->setAncestorClass('PhabricatorFlaggableInterface')
+ ->loadObjects();
+ $all_types = PhabricatorPHIDType::getAllTypes();
+ $options = array();
+ foreach ($objects as $object) {
+ $phid = $object->generatePHID();
+ $phid_type = phid_get_type($phid);
+ $type_object = idx($all_types, $phid_type);
+ if ($type_object) {
+ $options[$phid_type] = $type_object->getTypeName();
+ }
+ }
+ // sort it alphabetically...
+ asort($options);
+ $default_option = array(
+ 0 => 'All Objects');
+ // ...and stick the default option on front
+ $options = array_merge($default_option, $options);
+
+ return $options;
+ }
+
}
diff --git a/src/applications/herald/storage/HeraldRule.php b/src/applications/herald/storage/HeraldRule.php
--- a/src/applications/herald/storage/HeraldRule.php
+++ b/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';
diff --git a/src/applications/macro/storage/PhabricatorFileImageMacro.php b/src/applications/macro/storage/PhabricatorFileImageMacro.php
--- a/src/applications/macro/storage/PhabricatorFileImageMacro.php
+++ b/src/applications/macro/storage/PhabricatorFileImageMacro.php
@@ -4,6 +4,7 @@
implements
PhabricatorSubscribableInterface,
PhabricatorApplicationTransactionInterface,
+ PhabricatorFlaggableInterface,
PhabricatorPolicyInterface {
protected $authorPHID;
diff --git a/src/applications/maniphest/storage/ManiphestTask.php b/src/applications/maniphest/storage/ManiphestTask.php
--- a/src/applications/maniphest/storage/ManiphestTask.php
+++ b/src/applications/maniphest/storage/ManiphestTask.php
@@ -5,6 +5,7 @@
PhabricatorMarkupInterface,
PhabricatorPolicyInterface,
PhabricatorTokenReceiverInterface,
+ PhabricatorFlaggableInterface,
PhrequentTrackableInterface,
PhabricatorCustomFieldInterface {
diff --git a/src/applications/paste/storage/PhabricatorPaste.php b/src/applications/paste/storage/PhabricatorPaste.php
--- a/src/applications/paste/storage/PhabricatorPaste.php
+++ b/src/applications/paste/storage/PhabricatorPaste.php
@@ -4,6 +4,7 @@
implements
PhabricatorSubscribableInterface,
PhabricatorTokenReceiverInterface,
+ PhabricatorFlaggableInterface,
PhabricatorPolicyInterface {
protected $title;
diff --git a/src/applications/phlux/storage/PhluxVariable.php b/src/applications/phlux/storage/PhluxVariable.php
--- a/src/applications/phlux/storage/PhluxVariable.php
+++ b/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;
diff --git a/src/applications/pholio/storage/PholioMock.php b/src/applications/pholio/storage/PholioMock.php
--- a/src/applications/pholio/storage/PholioMock.php
+++ b/src/applications/pholio/storage/PholioMock.php
@@ -9,6 +9,7 @@
PhabricatorPolicyInterface,
PhabricatorSubscribableInterface,
PhabricatorTokenReceiverInterface,
+ PhabricatorFlaggableInterface,
PhabricatorApplicationTransactionInterface {
const MARKUP_FIELD_DESCRIPTION = 'markup:description';
diff --git a/src/applications/phriction/storage/PhrictionDocument.php b/src/applications/phriction/storage/PhrictionDocument.php
--- a/src/applications/phriction/storage/PhrictionDocument.php
+++ b/src/applications/phriction/storage/PhrictionDocument.php
@@ -7,6 +7,7 @@
implements
PhabricatorPolicyInterface,
PhabricatorSubscribableInterface,
+ PhabricatorFlaggableInterface,
PhabricatorTokenReceiverInterface {
protected $slug;
diff --git a/src/applications/ponder/storage/PonderAnswer.php b/src/applications/ponder/storage/PonderAnswer.php
--- a/src/applications/ponder/storage/PonderAnswer.php
+++ b/src/applications/ponder/storage/PonderAnswer.php
@@ -5,6 +5,7 @@
PhabricatorMarkupInterface,
PonderVotableInterface,
PhabricatorPolicyInterface,
+ PhabricatorFlaggableInterface,
PhabricatorSubscribableInterface,
PhabricatorTokenReceiverInterface {
diff --git a/src/applications/ponder/storage/PonderQuestion.php b/src/applications/ponder/storage/PonderQuestion.php
--- a/src/applications/ponder/storage/PonderQuestion.php
+++ b/src/applications/ponder/storage/PonderQuestion.php
@@ -5,6 +5,7 @@
PhabricatorMarkupInterface,
PonderVotableInterface,
PhabricatorSubscribableInterface,
+ PhabricatorFlaggableInterface,
PhabricatorPolicyInterface,
PhabricatorTokenReceiverInterface {
diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php
--- a/src/applications/project/storage/PhabricatorProject.php
+++ b/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;
diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php
--- a/src/applications/repository/storage/PhabricatorRepository.php
+++ b/src/applications/repository/storage/PhabricatorRepository.php
@@ -6,6 +6,7 @@
final class PhabricatorRepository extends PhabricatorRepositoryDAO
implements
PhabricatorPolicyInterface,
+ PhabricatorFlaggableInterface,
PhabricatorMarkupInterface {
/**
diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommit.php b/src/applications/repository/storage/PhabricatorRepositoryCommit.php
--- a/src/applications/repository/storage/PhabricatorRepositoryCommit.php
+++ b/src/applications/repository/storage/PhabricatorRepositoryCommit.php
@@ -4,6 +4,7 @@
extends PhabricatorRepositoryDAO
implements
PhabricatorPolicyInterface,
+ PhabricatorFlaggableInterface,
PhabricatorTokenReceiverInterface {
protected $repositoryID;
diff --git a/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php b/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
--- a/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
+++ b/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php
@@ -7,6 +7,7 @@
implements
PhabricatorPolicyInterface,
PhabricatorSubscribableInterface,
+ PhabricatorFlaggableInterface,
PhabricatorTokenReceiverInterface {
const RESPONSES_VISIBLE = 0;
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/nv/vc/7ymczrando7q4git
Default Alt Text
D7392.id16677.diff (17 KB)
Attached To
Mode
D7392: Add filter by object ability to flag query
Attached
Detach File
Event Timeline
Log In to Comment