mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
d6a620be45
Summary: Ref T12671. This modernized Maniphest transactions to modular transactions. Test Plan: - Create Task - Edit Task - Raise Priority - Change Status - Merge as a duplicate - Create Subtask - Claim Task - Assign Project - Move on Workboard - Set a cover image - Assign story points - Change story points - Generate lots via lipsum - Bulk edit tasks - Leave comments - Award Token I'm sure I'm missing something. Reviewers: epriestley Reviewed By: epriestley Subscribers: hazelyang, Korvin Maniphest Tasks: T12671 Differential Revision: https://secure.phabricator.com/D17844
53 lines
1.4 KiB
PHP
53 lines
1.4 KiB
PHP
<?php
|
|
|
|
final class PhabricatorProjectCoverController
|
|
extends PhabricatorProjectController {
|
|
|
|
public function handleRequest(AphrontRequest $request) {
|
|
$viewer = $request->getViewer();
|
|
|
|
$request->validateCSRF();
|
|
|
|
$board_phid = $request->getStr('boardPHID');
|
|
$object_phid = $request->getStr('objectPHID');
|
|
$file_phid = $request->getStr('filePHID');
|
|
|
|
$object = id(new ManiphestTaskQuery())
|
|
->setViewer($viewer)
|
|
->withPHIDs(array($object_phid))
|
|
->requireCapabilities(
|
|
array(
|
|
PhabricatorPolicyCapability::CAN_VIEW,
|
|
PhabricatorPolicyCapability::CAN_EDIT,
|
|
))
|
|
->executeOne();
|
|
if (!$object) {
|
|
return new Aphront404Response();
|
|
}
|
|
|
|
$file = id(new PhabricatorFileQuery())
|
|
->setViewer($viewer)
|
|
->withPHIDs(array($file_phid))
|
|
->executeOne();
|
|
if (!$file) {
|
|
return new Aphront404Response();
|
|
}
|
|
|
|
$xactions = array();
|
|
|
|
$xactions[] = id(new ManiphestTransaction())
|
|
->setTransactionType(ManiphestTaskCoverImageTransaction::TRANSACTIONTYPE)
|
|
->setNewValue($file->getPHID());
|
|
|
|
$editor = id(new ManiphestTransactionEditor())
|
|
->setActor($viewer)
|
|
->setContinueOnMissingFields(true)
|
|
->setContinueOnNoEffect(true)
|
|
->setContentSourceFromRequest($request);
|
|
|
|
$editor->applyTransactions($object, $xactions);
|
|
|
|
return $this->newCardResponse($board_phid, $object_phid);
|
|
}
|
|
|
|
}
|