Page MenuHomePhabricator

D9420.id22497.diff
No OneTemporary

D9420.id22497.diff

diff --git a/src/applications/pholio/controller/PholioMockEditController.php b/src/applications/pholio/controller/PholioMockEditController.php
--- a/src/applications/pholio/controller/PholioMockEditController.php
+++ b/src/applications/pholio/controller/PholioMockEditController.php
@@ -47,6 +47,15 @@
$mock_images = array();
}
+ if ($is_new) {
+ $v_projects = array();
+ } else {
+ $v_projects = PhabricatorEdgeQuery::loadDestinationPHIDs(
+ $mock->getPHID(),
+ PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT);
+ $v_projects = array_reverse($v_projects);
+ }
+
$e_name = true;
$e_images = true;
$errors = array();
@@ -73,6 +82,7 @@
$v_status = $request->getStr('status');
$v_view = $request->getStr('can_view');
$v_cc = $request->getArr('cc');
+ $v_projects = $request->getArr('projects');
$mock_xactions = array();
$mock_xactions[$type_name] = $v_name;
@@ -177,6 +187,7 @@
PholioTransactionType::TYPE_IMAGE_SEQUENCE)
->setNewValue(
array($existing_image->getPHID() => $sequence));
+
$posted_mock_images[] = $existing_image;
}
}
@@ -191,6 +202,12 @@
}
if (!$errors) {
+ $proj_edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_PROJECT;
+ $xactions[] = id(new PholioTransaction())
+ ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
+ ->setMetadataValue('edge:type', $proj_edge_type)
+ ->setNewValue(array('=' => array_fuse($v_projects)));
+
$mock->openTransaction();
$editor = id(new PholioMockEditor())
->setContentSourceFromRequest($request)
@@ -286,6 +303,12 @@
),
));
+ if ($v_projects) {
+ $project_handles = $this->loadViewerHandles($v_projects);
+ } else {
+ $project_handles = array();
+ }
+
require_celerity_resource('pholio-edit-css');
$form = id(new AphrontFormView())
->setUser($user)
@@ -310,6 +333,12 @@
->setOptions($mock->getStatuses()))
->appendChild(
id(new AphrontFormTokenizerControl())
+ ->setLabel(pht('Projects'))
+ ->setName('projects')
+ ->setValue($project_handles)
+ ->setDatasource('/typeahead/common/projects/'))
+ ->appendChild(
+ id(new AphrontFormTokenizerControl())
->setLabel(pht('CC'))
->setName('cc')
->setValue($handles)
diff --git a/src/applications/pholio/editor/PholioMockEditor.php b/src/applications/pholio/editor/PholioMockEditor.php
--- a/src/applications/pholio/editor/PholioMockEditor.php
+++ b/src/applications/pholio/editor/PholioMockEditor.php
@@ -203,6 +203,8 @@
case PholioTransactionType::TYPE_STATUS:
$object->setStatus($xaction->getNewValue());
break;
+ case PhabricatorTransactions::TYPE_EDGE:
+ return;
}
}
@@ -270,6 +272,8 @@
$image->setSequence($value);
$image->save();
break;
+ case PhabricatorTransactions::TYPE_EDGE:
+ return;
}
}
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
@@ -7,7 +7,8 @@
PhabricatorSubscribableInterface,
PhabricatorTokenReceiverInterface,
PhabricatorFlaggableInterface,
- PhabricatorApplicationTransactionInterface {
+ PhabricatorApplicationTransactionInterface,
+ PhabricatorProjectInterface {
const MARKUP_FIELD_DESCRIPTION = 'markup:description';

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 16, 2:39 AM (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7386238
Default Alt Text
D9420.id22497.diff (3 KB)

Event Timeline