Page MenuHomePhabricator

D7392.id.diff
No OneTemporary

D7392.id.diff

Index: src/__phutil_library_map__.php
===================================================================
--- src/__phutil_library_map__.php
+++ src/__phutil_library_map__.php
@@ -1299,6 +1299,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',
@@ -2587,7 +2588,8 @@
0 => 'DifferentialDAO',
1 => 'PhabricatorTokenReceiverInterface',
2 => 'PhabricatorPolicyInterface',
- 3 => 'PhrequentTrackableInterface',
+ 3 => 'PhabricatorFlaggableInterface',
+ 4 => 'PhrequentTrackableInterface',
),
'DifferentialRevisionCommentListView' => 'AphrontView',
'DifferentialRevisionCommentView' => 'AphrontView',
@@ -2883,7 +2885,8 @@
'HeraldRule' =>
array(
0 => 'HeraldDAO',
- 1 => 'PhabricatorPolicyInterface',
+ 1 => 'PhabricatorFlaggableInterface',
+ 2 => 'PhabricatorPolicyInterface',
),
'HeraldRuleController' => 'HeraldController',
'HeraldRuleEdit' => 'HeraldDAO',
@@ -2998,8 +3001,9 @@
1 => 'PhabricatorMarkupInterface',
2 => 'PhabricatorPolicyInterface',
3 => 'PhabricatorTokenReceiverInterface',
- 4 => 'PhrequentTrackableInterface',
- 5 => 'PhabricatorCustomFieldInterface',
+ 4 => 'PhabricatorFlaggableInterface',
+ 5 => 'PhrequentTrackableInterface',
+ 6 => 'PhabricatorCustomFieldInterface',
),
'ManiphestTaskDescriptionPreviewController' => 'ManiphestController',
'ManiphestTaskDetailController' => 'ManiphestController',
@@ -3518,7 +3522,8 @@
0 => 'PhabricatorFileDAO',
1 => 'PhabricatorTokenReceiverInterface',
2 => 'PhabricatorSubscribableInterface',
- 3 => 'PhabricatorPolicyInterface',
+ 3 => 'PhabricatorFlaggableInterface',
+ 4 => 'PhabricatorPolicyInterface',
),
'PhabricatorFileCommentController' => 'PhabricatorFileController',
'PhabricatorFileComposeController' => 'PhabricatorFileController',
@@ -3533,7 +3538,8 @@
0 => 'PhabricatorFileDAO',
1 => 'PhabricatorSubscribableInterface',
2 => 'PhabricatorApplicationTransactionInterface',
- 3 => 'PhabricatorPolicyInterface',
+ 3 => 'PhabricatorFlaggableInterface',
+ 4 => 'PhabricatorPolicyInterface',
),
'PhabricatorFileInfoController' => 'PhabricatorFileController',
'PhabricatorFileLinkListView' => 'AphrontView',
@@ -3764,7 +3770,8 @@
0 => 'PhabricatorPasteDAO',
1 => 'PhabricatorSubscribableInterface',
2 => 'PhabricatorTokenReceiverInterface',
- 3 => 'PhabricatorPolicyInterface',
+ 3 => 'PhabricatorFlaggableInterface',
+ 4 => 'PhabricatorPolicyInterface',
),
'PhabricatorPasteCommentController' => 'PhabricatorPasteController',
'PhabricatorPasteConfigOptions' => 'PhabricatorApplicationConfigOptions',
@@ -3846,7 +3853,8 @@
'PhabricatorProject' =>
array(
0 => 'PhabricatorProjectDAO',
- 1 => 'PhabricatorPolicyInterface',
+ 1 => 'PhabricatorFlaggableInterface',
+ 2 => 'PhabricatorPolicyInterface',
),
'PhabricatorProjectBoardController' => 'PhabricatorProjectController',
'PhabricatorProjectColumn' =>
@@ -3904,7 +3912,8 @@
array(
0 => 'PhabricatorRepositoryDAO',
1 => 'PhabricatorPolicyInterface',
- 2 => 'PhabricatorMarkupInterface',
+ 2 => 'PhabricatorFlaggableInterface',
+ 3 => 'PhabricatorMarkupInterface',
),
'PhabricatorRepositoryArcanistProject' =>
array(
@@ -3920,7 +3929,8 @@
array(
0 => 'PhabricatorRepositoryDAO',
1 => 'PhabricatorPolicyInterface',
- 2 => 'PhabricatorTokenReceiverInterface',
+ 2 => 'PhabricatorFlaggableInterface',
+ 3 => 'PhabricatorTokenReceiverInterface',
),
'PhabricatorRepositoryCommitChangeParserWorker' => 'PhabricatorRepositoryCommitParserWorker',
'PhabricatorRepositoryCommitData' => 'PhabricatorRepositoryDAO',
@@ -4045,7 +4055,8 @@
0 => 'PhabricatorSlowvoteDAO',
1 => 'PhabricatorPolicyInterface',
2 => 'PhabricatorSubscribableInterface',
- 3 => 'PhabricatorTokenReceiverInterface',
+ 3 => 'PhabricatorFlaggableInterface',
+ 4 => 'PhabricatorTokenReceiverInterface',
),
'PhabricatorSlowvotePollController' => 'PhabricatorSlowvoteController',
'PhabricatorSlowvoteQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
@@ -4247,7 +4258,8 @@
'PhluxVariable' =>
array(
0 => 'PhluxDAO',
- 1 => 'PhabricatorPolicyInterface',
+ 1 => 'PhabricatorFlaggableInterface',
+ 2 => 'PhabricatorPolicyInterface',
),
'PhluxVariableEditor' => 'PhabricatorApplicationTransactionEditor',
'PhluxVariableQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
@@ -4280,7 +4292,8 @@
2 => 'PhabricatorPolicyInterface',
3 => 'PhabricatorSubscribableInterface',
4 => 'PhabricatorTokenReceiverInterface',
- 5 => 'PhabricatorApplicationTransactionInterface',
+ 5 => 'PhabricatorFlaggableInterface',
+ 6 => 'PhabricatorApplicationTransactionInterface',
),
'PholioMockCommentController' => 'PholioController',
'PholioMockEditController' => 'PholioController',
@@ -4394,7 +4407,8 @@
0 => 'PhrictionDAO',
1 => 'PhabricatorPolicyInterface',
2 => 'PhabricatorSubscribableInterface',
- 3 => 'PhabricatorTokenReceiverInterface',
+ 3 => 'PhabricatorFlaggableInterface',
+ 4 => 'PhabricatorTokenReceiverInterface',
),
'PhrictionDocumentController' => 'PhrictionController',
'PhrictionDocumentEditor' => 'PhabricatorEditor',
@@ -4422,8 +4436,9 @@
1 => 'PhabricatorMarkupInterface',
2 => 'PonderVotableInterface',
3 => 'PhabricatorPolicyInterface',
- 4 => 'PhabricatorSubscribableInterface',
- 5 => 'PhabricatorTokenReceiverInterface',
+ 4 => 'PhabricatorFlaggableInterface',
+ 5 => 'PhabricatorSubscribableInterface',
+ 6 => 'PhabricatorTokenReceiverInterface',
),
'PonderAnswerCommentController' => 'PonderController',
'PonderAnswerEditController' => 'PonderController',
@@ -4451,8 +4466,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,7 @@
+<?php
+
+interface PhabricatorFlaggableInterface {
+
+ public function getPHID();
+
+}
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->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;
+ }
+
}
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, Nov 4, 2:32 AM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6719274
Default Alt Text
D7392.id.diff (17 KB)

Event Timeline