Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14711313
D9341.id22324.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D9341.id22324.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
@@ -4663,6 +4663,7 @@
2 => 'PhabricatorTokenReceiverInterface',
3 => 'PhabricatorFlaggableInterface',
4 => 'PhabricatorPolicyInterface',
+ 5 => 'PhabricatorProjectInterface',
),
'PhabricatorPasteCommentController' => 'PhabricatorPasteController',
'PhabricatorPasteConfigOptions' => 'PhabricatorApplicationConfigOptions',
diff --git a/src/applications/paste/controller/PhabricatorPasteEditController.php b/src/applications/paste/controller/PhabricatorPasteEditController.php
--- a/src/applications/paste/controller/PhabricatorPasteEditController.php
+++ b/src/applications/paste/controller/PhabricatorPasteEditController.php
@@ -75,6 +75,15 @@
}
$v_policy = $paste->getViewPolicy();
+ if ($is_create) {
+ $v_projects = array();
+ } else {
+ $v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs(
+ $paste->getPHID(),
+ PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT);
+ $v_projects = array_reverse($v_projects);
+ }
+
if ($request->isFormPost()) {
$xactions = array();
@@ -89,6 +98,7 @@
$v_title = $request->getStr('title');
$v_language = $request->getStr('language');
$v_policy = $request->getStr('can_view');
+ $v_projects = $request->getArr('projects');
// NOTE: The author is the only editor and can always view the paste,
// so it's impossible for them to choose an invalid policy.
@@ -114,6 +124,13 @@
$xactions[] = id(new PhabricatorPasteTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY)
->setNewValue($v_policy);
+
+ $proj_edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT;
+ $xactions[] = id(new PhabricatorPasteTransaction())
+ ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
+ ->setMetadataValue('edge:type', $proj_edge_type)
+ ->setNewValue(array('=' => array_fuse($v_projects)));
+
$editor = id(new PhabricatorPasteEditor())
->setActor($user)
->setContentSourceFromRequest($request)
@@ -161,6 +178,20 @@
->setPolicies($policies)
->setName('can_view'));
+
+ if ($v_projects) {
+ $project_handles = $this->loadViewerHandles($v_projects);
+ } else {
+ $project_handles = array();
+ }
+
+ $form->appendChild(
+ id(new AphrontFormTokenizerControl())
+ ->setLabel(pht('Projects'))
+ ->setName('projects')
+ ->setValue($project_handles)
+ ->setDatasource('/typeahead/common/projects/'));
+
$form
->appendChild(
id(new AphrontFormTextAreaControl())
diff --git a/src/applications/paste/editor/PhabricatorPasteEditor.php b/src/applications/paste/editor/PhabricatorPasteEditor.php
--- a/src/applications/paste/editor/PhabricatorPasteEditor.php
+++ b/src/applications/paste/editor/PhabricatorPasteEditor.php
@@ -77,6 +77,7 @@
return;
case PhabricatorTransactions::TYPE_COMMENT:
case PhabricatorTransactions::TYPE_SUBSCRIBERS:
+ case PhabricatorTransactions::TYPE_EDGE:
return;
}
@@ -94,6 +95,7 @@
case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_COMMENT:
case PhabricatorTransactions::TYPE_SUBSCRIBERS:
+ case PhabricatorTransactions::TYPE_EDGE:
return;
}
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
@@ -5,7 +5,8 @@
PhabricatorSubscribableInterface,
PhabricatorTokenReceiverInterface,
PhabricatorFlaggableInterface,
- PhabricatorPolicyInterface {
+ PhabricatorPolicyInterface,
+ PhabricatorProjectInterface {
protected $title;
protected $authorPHID;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 18, 2:43 PM (4 h, 22 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7003684
Default Alt Text
D9341.id22324.diff (3 KB)
Attached To
Mode
D9341: Implement PhabricatorProjectInterface in Paste
Attached
Detach File
Event Timeline
Log In to Comment