1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

Fix missing file attachment in Phriction

Summary:
When you drag and drop a file in the Phriction editor and then save the
corresponding wiki document, the file was only visible by the author.

Now the file is also attached to that document, making it visible.

Refs T15106

Test Plan:
1) open the Phriction editor to edit an existing or create a new wiki document
2) drag and drop file in it
3) save wiki document
4) verify file is attached to wiki document (other user can see file in wiki page)

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15106

Differential Revision: https://we.phorge.it/D25705
This commit is contained in:
Valerio Bozzolan 2024-07-01 18:40:28 +02:00 committed by Merula Turdus
parent 30257515eb
commit 118f989366

View file

@ -134,9 +134,31 @@ final class PhrictionEditController
$xactions[] = id(new PhrictionTransaction()) $xactions[] = id(new PhrictionTransaction())
->setTransactionType(PhrictionDocumentTitleTransaction::TRANSACTIONTYPE) ->setTransactionType(PhrictionDocumentTitleTransaction::TRANSACTIONTYPE)
->setNewValue($title); ->setNewValue($title);
$xactions[] = id(new PhrictionTransaction()) $content_xaction = id(new PhrictionTransaction())
->setTransactionType($edit_type) ->setTransactionType($edit_type)
->setNewValue($content_text); ->setNewValue($content_text);
$content_metadata = $request->getStr('content_metadata');
if ($content_metadata) {
$content_metadata = phutil_json_decode($content_metadata);
$attached_file_phids = idx(
$content_metadata,
'attachedFilePHIDs',
array());
if ($attached_file_phids) {
$metadata_object = array(
'remarkup.control' => array(
'attachedFilePHIDs' => $attached_file_phids,
),
);
$content_xaction->setMetadata($metadata_object);
}
}
$xactions[] = $content_xaction;
$xactions[] = id(new PhrictionTransaction()) $xactions[] = id(new PhrictionTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY) ->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY)
->setNewValue($v_view) ->setNewValue($v_view)