Page MenuHomePhorge

D25705.1735162695.diff
No OneTemporary

D25705.1735162695.diff

diff --git a/src/applications/phriction/controller/PhrictionEditController.php b/src/applications/phriction/controller/PhrictionEditController.php
--- a/src/applications/phriction/controller/PhrictionEditController.php
+++ b/src/applications/phriction/controller/PhrictionEditController.php
@@ -117,6 +117,16 @@
$v_cc = $request->getArr('cc');
$v_projects = $request->getArr('projects');
$v_space = $request->getStr('spacePHID');
+ $file_phids_to_attach = [];
+
+ $content_metadata = $request->getStr('content_metadata');
+ if (!!$content_metadata) {
+ $content_metadata = json_decode($content_metadata);
+ if (isset($content_metadata->attachedFilePHIDs)) {
+ $file_phids_to_attach = $content_metadata->attachedFilePHIDs;
+ }
+ }
+
if ($save_as_draft) {
$edit_type = PhrictionDocumentDraftTransaction::TRANSACTIONTYPE;
@@ -134,9 +144,27 @@
$xactions[] = id(new PhrictionTransaction())
->setTransactionType(PhrictionDocumentTitleTransaction::TRANSACTIONTYPE)
->setNewValue($title);
- $xactions[] = id(new PhrictionTransaction())
+ $content_xaction = id(new PhrictionTransaction())
->setTransactionType($edit_type)
->setNewValue($content_text);
+
+ if (!empty($file_phids_to_attach)) {
+ $attached_file_phids = [];
+ foreach ($file_phids_to_attach as $phid) {
+ $attached_file_phids[$phid] = $phid;
+ }
+
+ $metadata_object = [
+ 'remarkup.control' => [
+ 'attachedFilePHIDs' => $attached_file_phids,
+ ],
+ ];
+
+ $content_xaction->setMetadata($metadata_object);
+ }
+
+ $xactions[] = $content_xaction;
+
$xactions[] = id(new PhrictionTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY)
->setNewValue($v_view)

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 25, 21:38 (2 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1034037
Default Alt Text
D25705.1735162695.diff (1 KB)

Event Timeline