Make the paste "Create" transaction take a file PHID instead of content

Summary:
Ref T4814. Although this approach made sense at one point, we have more file infrastructure now and T4814 will be easier if we just pass a PHID in.

Also swap Conduit over to use the Editor.

Test Plan:
  - Created a paste.
  - Created a paste via Conduit.
  - Verified that files had correct permissions and appropriate object links in Files.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4814

Differential Revision: https://secure.phabricator.com/D8969
This commit is contained in:
epriestley
2014-05-04 11:11:34 -07:00
parent a272ddcc78
commit c2f58496ad
5 changed files with 92 additions and 90 deletions

View File

@@ -95,12 +95,16 @@ final class PhabricatorPasteEditController extends PhabricatorPasteController {
if (!$errors) {
if ($is_create) {
$file = PhabricatorPasteEditor::initializeFileForPaste(
$user,
$v_title,
$v_text);
$xactions[] = id(new PhabricatorPasteTransaction())
->setTransactionType(PhabricatorPasteTransaction::TYPE_CREATE)
->setNewValue(array(
'title' => $v_title,
'text' => $v_text));
->setNewValue($file->getPHID());
}
$xactions[] = id(new PhabricatorPasteTransaction())
->setTransactionType(PhabricatorPasteTransaction::TYPE_TITLE)
->setNewValue($v_title);