mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 04:50:55 +01:00
Remove "ManiphestTransactionEditorPro"
Summary: Drop the "Pro" bit. Test Plan: Created/edited tasks, moved tasks around, generally made a mess. Nothing burned down. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D7352
This commit is contained in:
parent
83c99be423
commit
baf2ea5b32
15 changed files with 262 additions and 280 deletions
|
@ -749,7 +749,6 @@ phutil_register_library_map(array(
|
||||||
'ManiphestTransaction' => 'applications/maniphest/storage/ManiphestTransaction.php',
|
'ManiphestTransaction' => 'applications/maniphest/storage/ManiphestTransaction.php',
|
||||||
'ManiphestTransactionComment' => 'applications/maniphest/storage/ManiphestTransactionComment.php',
|
'ManiphestTransactionComment' => 'applications/maniphest/storage/ManiphestTransactionComment.php',
|
||||||
'ManiphestTransactionEditor' => 'applications/maniphest/editor/ManiphestTransactionEditor.php',
|
'ManiphestTransactionEditor' => 'applications/maniphest/editor/ManiphestTransactionEditor.php',
|
||||||
'ManiphestTransactionEditorPro' => 'applications/maniphest/editor/ManiphestTransactionEditorPro.php',
|
|
||||||
'ManiphestTransactionPreviewController' => 'applications/maniphest/controller/ManiphestTransactionPreviewController.php',
|
'ManiphestTransactionPreviewController' => 'applications/maniphest/controller/ManiphestTransactionPreviewController.php',
|
||||||
'ManiphestTransactionQuery' => 'applications/maniphest/query/ManiphestTransactionQuery.php',
|
'ManiphestTransactionQuery' => 'applications/maniphest/query/ManiphestTransactionQuery.php',
|
||||||
'ManiphestTransactionSaveController' => 'applications/maniphest/controller/ManiphestTransactionSaveController.php',
|
'ManiphestTransactionSaveController' => 'applications/maniphest/controller/ManiphestTransactionSaveController.php',
|
||||||
|
@ -2895,8 +2894,7 @@ phutil_register_library_map(array(
|
||||||
'ManiphestTaskSubscriber' => 'ManiphestDAO',
|
'ManiphestTaskSubscriber' => 'ManiphestDAO',
|
||||||
'ManiphestTransaction' => 'PhabricatorApplicationTransaction',
|
'ManiphestTransaction' => 'PhabricatorApplicationTransaction',
|
||||||
'ManiphestTransactionComment' => 'PhabricatorApplicationTransactionComment',
|
'ManiphestTransactionComment' => 'PhabricatorApplicationTransactionComment',
|
||||||
'ManiphestTransactionEditor' => 'PhabricatorEditor',
|
'ManiphestTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||||
'ManiphestTransactionEditorPro' => 'PhabricatorApplicationTransactionEditor',
|
|
||||||
'ManiphestTransactionPreviewController' => 'ManiphestController',
|
'ManiphestTransactionPreviewController' => 'ManiphestController',
|
||||||
'ManiphestTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
'ManiphestTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
||||||
'ManiphestTransactionSaveController' => 'ManiphestController',
|
'ManiphestTransactionSaveController' => 'ManiphestController',
|
||||||
|
|
|
@ -199,7 +199,7 @@ abstract class ConduitAPI_maniphest_Method extends ConduitAPIMethod {
|
||||||
PhabricatorContentSource::SOURCE_CONDUIT,
|
PhabricatorContentSource::SOURCE_CONDUIT,
|
||||||
array());
|
array());
|
||||||
|
|
||||||
$editor = id(new ManiphestTransactionEditorPro())
|
$editor = id(new ManiphestTransactionEditor())
|
||||||
->setActor($request->getUser())
|
->setActor($request->getUser())
|
||||||
->setContentSource($content_source)
|
->setContentSource($content_source)
|
||||||
->setContinueOnNoEffect(true);
|
->setContinueOnNoEffect(true);
|
||||||
|
|
|
@ -37,7 +37,7 @@ final class ManiphestBatchEditController extends ManiphestController {
|
||||||
if ($xactions) {
|
if ($xactions) {
|
||||||
// TODO: Set content source to "batch edit".
|
// TODO: Set content source to "batch edit".
|
||||||
|
|
||||||
$editor = id(new ManiphestTransactionEditorPro())
|
$editor = id(new ManiphestTransactionEditor())
|
||||||
->setActor($user)
|
->setActor($user)
|
||||||
->setContentSourceFromRequest($request)
|
->setContentSourceFromRequest($request)
|
||||||
->setContinueOnNoEffect(true)
|
->setContinueOnNoEffect(true)
|
||||||
|
|
|
@ -53,7 +53,7 @@ final class ManiphestSubpriorityController extends ManiphestController {
|
||||||
->setTransactionType(ManiphestTransaction::TYPE_PRIORITY)
|
->setTransactionType(ManiphestTransaction::TYPE_PRIORITY)
|
||||||
->setNewValue($after_pri);
|
->setNewValue($after_pri);
|
||||||
|
|
||||||
$editor = id(new ManiphestTransactionEditorPro())
|
$editor = id(new ManiphestTransactionEditor())
|
||||||
->setActor($user)
|
->setActor($user)
|
||||||
->setContinueOnMissingFields(true)
|
->setContinueOnMissingFields(true)
|
||||||
->setContinueOnNoEffect(true)
|
->setContinueOnNoEffect(true)
|
||||||
|
|
|
@ -39,7 +39,7 @@ final class ManiphestSubscribeController extends ManiphestController {
|
||||||
->setTransactionType(ManiphestTransaction::TYPE_CCS)
|
->setTransactionType(ManiphestTransaction::TYPE_CCS)
|
||||||
->setNewValue($ccs);
|
->setNewValue($ccs);
|
||||||
|
|
||||||
$editor = id(new ManiphestTransactionEditorPro())
|
$editor = id(new ManiphestTransactionEditor())
|
||||||
->setActor($user)
|
->setActor($user)
|
||||||
->setContentSourceFromRequest($request)
|
->setContentSourceFromRequest($request)
|
||||||
->setContinueOnNoEffect(true)
|
->setContinueOnNoEffect(true)
|
||||||
|
|
|
@ -237,7 +237,7 @@ final class ManiphestTaskEditController extends ManiphestController {
|
||||||
$task = $event->getValue('task');
|
$task = $event->getValue('task');
|
||||||
$transactions = $event->getValue('transactions');
|
$transactions = $event->getValue('transactions');
|
||||||
|
|
||||||
$editor = id(new ManiphestTransactionEditorPro())
|
$editor = id(new ManiphestTransactionEditor())
|
||||||
->setActor($user)
|
->setActor($user)
|
||||||
->setContentSourceFromRequest($request)
|
->setContentSourceFromRequest($request)
|
||||||
->setContinueOnNoEffect(true)
|
->setContinueOnNoEffect(true)
|
||||||
|
|
|
@ -222,7 +222,7 @@ final class ManiphestTransactionSaveController extends ManiphestController {
|
||||||
$task = $event->getValue('task');
|
$task = $event->getValue('task');
|
||||||
$transactions = $event->getValue('transactions');
|
$transactions = $event->getValue('transactions');
|
||||||
|
|
||||||
$editor = id(new ManiphestTransactionEditorPro())
|
$editor = id(new ManiphestTransactionEditor())
|
||||||
->setActor($user)
|
->setActor($user)
|
||||||
->setContentSourceFromRequest($request)
|
->setContentSourceFromRequest($request)
|
||||||
->setContinueOnMissingFields(true)
|
->setContinueOnMissingFields(true)
|
||||||
|
|
|
@ -1,16 +1,252 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
final class ManiphestTransactionEditor
|
||||||
* @group maniphest
|
extends PhabricatorApplicationTransactionEditor {
|
||||||
*/
|
|
||||||
final class ManiphestTransactionEditor extends PhabricatorEditor {
|
|
||||||
|
|
||||||
public function buildReplyHandler(ManiphestTask $task) {
|
public function getTransactionTypes() {
|
||||||
$handler_object = PhabricatorEnv::newObjectFromConfig(
|
$types = parent::getTransactionTypes();
|
||||||
'metamta.maniphest.reply-handler');
|
|
||||||
$handler_object->setMailReceiver($task);
|
|
||||||
|
|
||||||
return $handler_object;
|
$types[] = PhabricatorTransactions::TYPE_COMMENT;
|
||||||
|
$types[] = ManiphestTransaction::TYPE_PRIORITY;
|
||||||
|
$types[] = ManiphestTransaction::TYPE_STATUS;
|
||||||
|
$types[] = ManiphestTransaction::TYPE_TITLE;
|
||||||
|
$types[] = ManiphestTransaction::TYPE_DESCRIPTION;
|
||||||
|
$types[] = ManiphestTransaction::TYPE_OWNER;
|
||||||
|
$types[] = ManiphestTransaction::TYPE_CCS;
|
||||||
|
$types[] = ManiphestTransaction::TYPE_PROJECTS;
|
||||||
|
$types[] = ManiphestTransaction::TYPE_ATTACH;
|
||||||
|
$types[] = ManiphestTransaction::TYPE_EDGE;
|
||||||
|
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
||||||
|
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
|
||||||
|
|
||||||
|
return $types;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getCustomTransactionOldValue(
|
||||||
|
PhabricatorLiskDAO $object,
|
||||||
|
PhabricatorApplicationTransaction $xaction) {
|
||||||
|
|
||||||
|
switch ($xaction->getTransactionType()) {
|
||||||
|
case ManiphestTransaction::TYPE_PRIORITY:
|
||||||
|
if ($this->getIsNewObject()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (int)$object->getPriority();
|
||||||
|
case ManiphestTransaction::TYPE_STATUS:
|
||||||
|
if ($this->getIsNewObject()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (int)$object->getStatus();
|
||||||
|
case ManiphestTransaction::TYPE_TITLE:
|
||||||
|
if ($this->getIsNewObject()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return $object->getTitle();
|
||||||
|
case ManiphestTransaction::TYPE_DESCRIPTION:
|
||||||
|
if ($this->getIsNewObject()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return $object->getDescription();
|
||||||
|
case ManiphestTransaction::TYPE_OWNER:
|
||||||
|
return nonempty($object->getOwnerPHID(), null);
|
||||||
|
case ManiphestTransaction::TYPE_CCS:
|
||||||
|
return array_values(array_unique($object->getCCPHIDs()));
|
||||||
|
case ManiphestTransaction::TYPE_PROJECTS:
|
||||||
|
return array_values(array_unique($object->getProjectPHIDs()));
|
||||||
|
case ManiphestTransaction::TYPE_ATTACH:
|
||||||
|
return $object->getAttached();
|
||||||
|
case ManiphestTransaction::TYPE_EDGE:
|
||||||
|
// These are pre-populated.
|
||||||
|
return $xaction->getOldValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getCustomTransactionNewValue(
|
||||||
|
PhabricatorLiskDAO $object,
|
||||||
|
PhabricatorApplicationTransaction $xaction) {
|
||||||
|
|
||||||
|
switch ($xaction->getTransactionType()) {
|
||||||
|
case ManiphestTransaction::TYPE_PRIORITY:
|
||||||
|
case ManiphestTransaction::TYPE_STATUS:
|
||||||
|
return (int)$xaction->getNewValue();
|
||||||
|
case ManiphestTransaction::TYPE_CCS:
|
||||||
|
case ManiphestTransaction::TYPE_PROJECTS:
|
||||||
|
return array_values(array_unique($xaction->getNewValue()));
|
||||||
|
case ManiphestTransaction::TYPE_OWNER:
|
||||||
|
return nonempty($xaction->getNewValue(), null);
|
||||||
|
case ManiphestTransaction::TYPE_TITLE:
|
||||||
|
case ManiphestTransaction::TYPE_DESCRIPTION:
|
||||||
|
case ManiphestTransaction::TYPE_ATTACH:
|
||||||
|
case ManiphestTransaction::TYPE_EDGE:
|
||||||
|
return $xaction->getNewValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function transactionHasEffect(
|
||||||
|
PhabricatorLiskDAO $object,
|
||||||
|
PhabricatorApplicationTransaction $xaction) {
|
||||||
|
|
||||||
|
$old = $xaction->getOldValue();
|
||||||
|
$new = $xaction->getNewValue();
|
||||||
|
|
||||||
|
switch ($xaction->getTransactionType()) {
|
||||||
|
case ManiphestTransaction::TYPE_PROJECTS:
|
||||||
|
case ManiphestTransaction::TYPE_CCS:
|
||||||
|
sort($old);
|
||||||
|
sort($new);
|
||||||
|
return ($old !== $new);
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::transactionHasEffect($object, $xaction);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function applyCustomInternalTransaction(
|
||||||
|
PhabricatorLiskDAO $object,
|
||||||
|
PhabricatorApplicationTransaction $xaction) {
|
||||||
|
|
||||||
|
switch ($xaction->getTransactionType()) {
|
||||||
|
case ManiphestTransaction::TYPE_PRIORITY:
|
||||||
|
return $object->setPriority($xaction->getNewValue());
|
||||||
|
case ManiphestTransaction::TYPE_STATUS:
|
||||||
|
return $object->setStatus($xaction->getNewValue());
|
||||||
|
case ManiphestTransaction::TYPE_TITLE:
|
||||||
|
return $object->setTitle($xaction->getNewValue());
|
||||||
|
case ManiphestTransaction::TYPE_DESCRIPTION:
|
||||||
|
return $object->setDescription($xaction->getNewValue());
|
||||||
|
case ManiphestTransaction::TYPE_OWNER:
|
||||||
|
return $object->setOwnerPHID($xaction->getNewValue());
|
||||||
|
case ManiphestTransaction::TYPE_CCS:
|
||||||
|
return $object->setCCPHIDs($xaction->getNewValue());
|
||||||
|
case ManiphestTransaction::TYPE_PROJECTS:
|
||||||
|
return $object->setProjectPHIDs($xaction->getNewValue());
|
||||||
|
case ManiphestTransaction::TYPE_ATTACH:
|
||||||
|
return $object->setAttached($xaction->getNewValue());
|
||||||
|
case ManiphestTransaction::TYPE_EDGE:
|
||||||
|
// These are a weird, funky mess and are already being applied by the
|
||||||
|
// time we reach this.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function applyCustomExternalTransaction(
|
||||||
|
PhabricatorLiskDAO $object,
|
||||||
|
PhabricatorApplicationTransaction $xaction) {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function shouldSendMail(
|
||||||
|
PhabricatorLiskDAO $object,
|
||||||
|
array $xactions) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getMailSubjectPrefix() {
|
||||||
|
return PhabricatorEnv::getEnvConfig('metamta.maniphest.subject-prefix');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getMailThreadID(PhabricatorLiskDAO $object) {
|
||||||
|
return 'maniphest-task-'.$object->getPHID();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getMailTo(PhabricatorLiskDAO $object) {
|
||||||
|
return array(
|
||||||
|
$object->getOwnerPHID(),
|
||||||
|
$this->requireActor()->getPHID(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getMailCC(PhabricatorLiskDAO $object) {
|
||||||
|
return $object->getCCPHIDs();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function buildReplyHandler(PhabricatorLiskDAO $object) {
|
||||||
|
return id(new ManiphestReplyHandler())
|
||||||
|
->setMailReceiver($object);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function buildMailTemplate(PhabricatorLiskDAO $object) {
|
||||||
|
$id = $object->getID();
|
||||||
|
$title = $object->getTitle();
|
||||||
|
|
||||||
|
return id(new PhabricatorMetaMTAMail())
|
||||||
|
->setSubject("T{$id}: {$title}")
|
||||||
|
->addHeader('Thread-Topic', "T{$id}: ".$object->getOriginalTitle());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function buildMailBody(
|
||||||
|
PhabricatorLiskDAO $object,
|
||||||
|
array $xactions) {
|
||||||
|
|
||||||
|
$body = parent::buildMailBody($object, $xactions);
|
||||||
|
|
||||||
|
if ($this->getIsNewObject()) {
|
||||||
|
$body->addTextSection(
|
||||||
|
pht('TASK DESCRIPTION'),
|
||||||
|
$object->getDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
$body->addTextSection(
|
||||||
|
pht('TASK DETAIL'),
|
||||||
|
PhabricatorEnv::getProductionURI('/T'.$object->getID()));
|
||||||
|
|
||||||
|
return $body;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function supportsFeed() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function supportsSearch() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function supportsHerald() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function buildHeraldAdapter(
|
||||||
|
PhabricatorLiskDAO $object,
|
||||||
|
array $xactions) {
|
||||||
|
|
||||||
|
return id(new HeraldManiphestTaskAdapter())
|
||||||
|
->setTask($object);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function didApplyHeraldRules(
|
||||||
|
PhabricatorLiskDAO $object,
|
||||||
|
HeraldAdapter $adapter,
|
||||||
|
HeraldTranscript $transcript) {
|
||||||
|
|
||||||
|
$save_again = false;
|
||||||
|
$cc_phids = $adapter->getCcPHIDs();
|
||||||
|
if ($cc_phids) {
|
||||||
|
$existing_cc = $object->getCCPHIDs();
|
||||||
|
$new_cc = array_unique(array_merge($cc_phids, $existing_cc));
|
||||||
|
$object->setCCPHIDs($new_cc);
|
||||||
|
$save_again = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$assign_phid = $adapter->getAssignPHID();
|
||||||
|
if ($assign_phid) {
|
||||||
|
$object->setOwnerPHID($assign_phid);
|
||||||
|
$save_again = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$project_phids = $adapter->getProjectPHIDs();
|
||||||
|
if ($project_phids) {
|
||||||
|
$existing_projects = $object->getProjectPHIDs();
|
||||||
|
$new_projects = array_unique(
|
||||||
|
array_merge($project_phids, $existing_projects));
|
||||||
|
$object->setProjectPHIDs($new_projects);
|
||||||
|
$save_again = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($save_again) {
|
||||||
|
$object->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getNextSubpriority($pri, $sub) {
|
public static function getNextSubpriority($pri, $sub) {
|
||||||
|
|
|
@ -1,252 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
final class ManiphestTransactionEditorPro
|
|
||||||
extends PhabricatorApplicationTransactionEditor {
|
|
||||||
|
|
||||||
public function getTransactionTypes() {
|
|
||||||
$types = parent::getTransactionTypes();
|
|
||||||
|
|
||||||
$types[] = PhabricatorTransactions::TYPE_COMMENT;
|
|
||||||
$types[] = ManiphestTransaction::TYPE_PRIORITY;
|
|
||||||
$types[] = ManiphestTransaction::TYPE_STATUS;
|
|
||||||
$types[] = ManiphestTransaction::TYPE_TITLE;
|
|
||||||
$types[] = ManiphestTransaction::TYPE_DESCRIPTION;
|
|
||||||
$types[] = ManiphestTransaction::TYPE_OWNER;
|
|
||||||
$types[] = ManiphestTransaction::TYPE_CCS;
|
|
||||||
$types[] = ManiphestTransaction::TYPE_PROJECTS;
|
|
||||||
$types[] = ManiphestTransaction::TYPE_ATTACH;
|
|
||||||
$types[] = ManiphestTransaction::TYPE_EDGE;
|
|
||||||
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
|
||||||
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
|
|
||||||
|
|
||||||
return $types;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getCustomTransactionOldValue(
|
|
||||||
PhabricatorLiskDAO $object,
|
|
||||||
PhabricatorApplicationTransaction $xaction) {
|
|
||||||
|
|
||||||
switch ($xaction->getTransactionType()) {
|
|
||||||
case ManiphestTransaction::TYPE_PRIORITY:
|
|
||||||
if ($this->getIsNewObject()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (int)$object->getPriority();
|
|
||||||
case ManiphestTransaction::TYPE_STATUS:
|
|
||||||
if ($this->getIsNewObject()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (int)$object->getStatus();
|
|
||||||
case ManiphestTransaction::TYPE_TITLE:
|
|
||||||
if ($this->getIsNewObject()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return $object->getTitle();
|
|
||||||
case ManiphestTransaction::TYPE_DESCRIPTION:
|
|
||||||
if ($this->getIsNewObject()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return $object->getDescription();
|
|
||||||
case ManiphestTransaction::TYPE_OWNER:
|
|
||||||
return nonempty($object->getOwnerPHID(), null);
|
|
||||||
case ManiphestTransaction::TYPE_CCS:
|
|
||||||
return array_values(array_unique($object->getCCPHIDs()));
|
|
||||||
case ManiphestTransaction::TYPE_PROJECTS:
|
|
||||||
return array_values(array_unique($object->getProjectPHIDs()));
|
|
||||||
case ManiphestTransaction::TYPE_ATTACH:
|
|
||||||
return $object->getAttached();
|
|
||||||
case ManiphestTransaction::TYPE_EDGE:
|
|
||||||
// These are pre-populated.
|
|
||||||
return $xaction->getOldValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getCustomTransactionNewValue(
|
|
||||||
PhabricatorLiskDAO $object,
|
|
||||||
PhabricatorApplicationTransaction $xaction) {
|
|
||||||
|
|
||||||
switch ($xaction->getTransactionType()) {
|
|
||||||
case ManiphestTransaction::TYPE_PRIORITY:
|
|
||||||
case ManiphestTransaction::TYPE_STATUS:
|
|
||||||
return (int)$xaction->getNewValue();
|
|
||||||
case ManiphestTransaction::TYPE_CCS:
|
|
||||||
case ManiphestTransaction::TYPE_PROJECTS:
|
|
||||||
return array_values(array_unique($xaction->getNewValue()));
|
|
||||||
case ManiphestTransaction::TYPE_OWNER:
|
|
||||||
return nonempty($xaction->getNewValue(), null);
|
|
||||||
case ManiphestTransaction::TYPE_TITLE:
|
|
||||||
case ManiphestTransaction::TYPE_DESCRIPTION:
|
|
||||||
case ManiphestTransaction::TYPE_ATTACH:
|
|
||||||
case ManiphestTransaction::TYPE_EDGE:
|
|
||||||
return $xaction->getNewValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function transactionHasEffect(
|
|
||||||
PhabricatorLiskDAO $object,
|
|
||||||
PhabricatorApplicationTransaction $xaction) {
|
|
||||||
|
|
||||||
$old = $xaction->getOldValue();
|
|
||||||
$new = $xaction->getNewValue();
|
|
||||||
|
|
||||||
switch ($xaction->getTransactionType()) {
|
|
||||||
case ManiphestTransaction::TYPE_PROJECTS:
|
|
||||||
case ManiphestTransaction::TYPE_CCS:
|
|
||||||
sort($old);
|
|
||||||
sort($new);
|
|
||||||
return ($old !== $new);
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::transactionHasEffect($object, $xaction);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected function applyCustomInternalTransaction(
|
|
||||||
PhabricatorLiskDAO $object,
|
|
||||||
PhabricatorApplicationTransaction $xaction) {
|
|
||||||
|
|
||||||
switch ($xaction->getTransactionType()) {
|
|
||||||
case ManiphestTransaction::TYPE_PRIORITY:
|
|
||||||
return $object->setPriority($xaction->getNewValue());
|
|
||||||
case ManiphestTransaction::TYPE_STATUS:
|
|
||||||
return $object->setStatus($xaction->getNewValue());
|
|
||||||
case ManiphestTransaction::TYPE_TITLE:
|
|
||||||
return $object->setTitle($xaction->getNewValue());
|
|
||||||
case ManiphestTransaction::TYPE_DESCRIPTION:
|
|
||||||
return $object->setDescription($xaction->getNewValue());
|
|
||||||
case ManiphestTransaction::TYPE_OWNER:
|
|
||||||
return $object->setOwnerPHID($xaction->getNewValue());
|
|
||||||
case ManiphestTransaction::TYPE_CCS:
|
|
||||||
return $object->setCCPHIDs($xaction->getNewValue());
|
|
||||||
case ManiphestTransaction::TYPE_PROJECTS:
|
|
||||||
return $object->setProjectPHIDs($xaction->getNewValue());
|
|
||||||
case ManiphestTransaction::TYPE_ATTACH:
|
|
||||||
return $object->setAttached($xaction->getNewValue());
|
|
||||||
case ManiphestTransaction::TYPE_EDGE:
|
|
||||||
// These are a weird, funky mess and are already being applied by the
|
|
||||||
// time we reach this.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function applyCustomExternalTransaction(
|
|
||||||
PhabricatorLiskDAO $object,
|
|
||||||
PhabricatorApplicationTransaction $xaction) {
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function shouldSendMail(
|
|
||||||
PhabricatorLiskDAO $object,
|
|
||||||
array $xactions) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getMailSubjectPrefix() {
|
|
||||||
return PhabricatorEnv::getEnvConfig('metamta.maniphest.subject-prefix');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getMailThreadID(PhabricatorLiskDAO $object) {
|
|
||||||
return 'maniphest-task-'.$object->getPHID();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getMailTo(PhabricatorLiskDAO $object) {
|
|
||||||
return array(
|
|
||||||
$object->getOwnerPHID(),
|
|
||||||
$this->requireActor()->getPHID(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getMailCC(PhabricatorLiskDAO $object) {
|
|
||||||
return $object->getCCPHIDs();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function buildReplyHandler(PhabricatorLiskDAO $object) {
|
|
||||||
return id(new ManiphestReplyHandler())
|
|
||||||
->setMailReceiver($object);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function buildMailTemplate(PhabricatorLiskDAO $object) {
|
|
||||||
$id = $object->getID();
|
|
||||||
$title = $object->getTitle();
|
|
||||||
|
|
||||||
return id(new PhabricatorMetaMTAMail())
|
|
||||||
->setSubject("T{$id}: {$title}")
|
|
||||||
->addHeader('Thread-Topic', "T{$id}: ".$object->getOriginalTitle());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function buildMailBody(
|
|
||||||
PhabricatorLiskDAO $object,
|
|
||||||
array $xactions) {
|
|
||||||
|
|
||||||
$body = parent::buildMailBody($object, $xactions);
|
|
||||||
|
|
||||||
if ($this->getIsNewObject()) {
|
|
||||||
$body->addTextSection(
|
|
||||||
pht('TASK DESCRIPTION'),
|
|
||||||
$object->getDescription());
|
|
||||||
}
|
|
||||||
|
|
||||||
$body->addTextSection(
|
|
||||||
pht('TASK DETAIL'),
|
|
||||||
PhabricatorEnv::getProductionURI('/T'.$object->getID()));
|
|
||||||
|
|
||||||
return $body;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function supportsFeed() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function supportsSearch() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function supportsHerald() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function buildHeraldAdapter(
|
|
||||||
PhabricatorLiskDAO $object,
|
|
||||||
array $xactions) {
|
|
||||||
|
|
||||||
return id(new HeraldManiphestTaskAdapter())
|
|
||||||
->setTask($object);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function didApplyHeraldRules(
|
|
||||||
PhabricatorLiskDAO $object,
|
|
||||||
HeraldAdapter $adapter,
|
|
||||||
HeraldTranscript $transcript) {
|
|
||||||
|
|
||||||
$save_again = false;
|
|
||||||
$cc_phids = $adapter->getCcPHIDs();
|
|
||||||
if ($cc_phids) {
|
|
||||||
$existing_cc = $object->getCCPHIDs();
|
|
||||||
$new_cc = array_unique(array_merge($cc_phids, $existing_cc));
|
|
||||||
$object->setCCPHIDs($new_cc);
|
|
||||||
$save_again = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$assign_phid = $adapter->getAssignPHID();
|
|
||||||
if ($assign_phid) {
|
|
||||||
$object->setOwnerPHID($assign_phid);
|
|
||||||
$save_again = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$project_phids = $adapter->getProjectPHIDs();
|
|
||||||
if ($project_phids) {
|
|
||||||
$existing_projects = $object->getProjectPHIDs();
|
|
||||||
$new_projects = array_unique(
|
|
||||||
array_merge($project_phids, $existing_projects));
|
|
||||||
$object->setProjectPHIDs($new_projects);
|
|
||||||
$save_again = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($save_again) {
|
|
||||||
$object->save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -63,7 +63,7 @@ final class ManiphestEdgeEventListener extends PhutilEventListener {
|
||||||
array());
|
array());
|
||||||
|
|
||||||
$new_edges = $this->loadAllEdges($event);
|
$new_edges = $this->loadAllEdges($event);
|
||||||
$editor = id(new ManiphestTransactionEditorPro())
|
$editor = id(new ManiphestTransactionEditor())
|
||||||
->setActor($event->getUser())
|
->setActor($event->getUser())
|
||||||
->setContentSource($content_source)
|
->setContentSource($content_source)
|
||||||
->setContinueOnNoEffect(true)
|
->setContinueOnNoEffect(true)
|
||||||
|
|
|
@ -42,7 +42,7 @@ final class PhabricatorManiphestTaskTestDataGenerator
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply Transactions
|
// Apply Transactions
|
||||||
$editor = id(new ManiphestTransactionEditorPro())
|
$editor = id(new ManiphestTransactionEditor())
|
||||||
->setActor($author)
|
->setActor($author)
|
||||||
->setContentSource($content_source)
|
->setContentSource($content_source)
|
||||||
->setContinueOnNoEffect(true)
|
->setContinueOnNoEffect(true)
|
||||||
|
|
|
@ -63,9 +63,9 @@ final class ManiphestCreateMailReceiver extends PhabricatorMailReceiver {
|
||||||
$task = ManiphestTask::initializeNewTask($sender);
|
$task = ManiphestTask::initializeNewTask($sender);
|
||||||
$task->setOriginalEmailSource($mail->getHeader('From'));
|
$task->setOriginalEmailSource($mail->getHeader('From'));
|
||||||
|
|
||||||
$editor = new ManiphestTransactionEditor();
|
$handler = PhabricatorEnv::newObjectFromConfig(
|
||||||
$editor->setActor($sender);
|
'metamta.maniphest.reply-handler');
|
||||||
$handler = $editor->buildReplyHandler($task);
|
$handler->setMailReceiver($task);
|
||||||
|
|
||||||
$handler->setActor($sender);
|
$handler->setActor($sender);
|
||||||
$handler->setExcludeMailRecipientPHIDs(
|
$handler->setExcludeMailRecipientPHIDs(
|
||||||
|
|
|
@ -165,7 +165,7 @@ final class ManiphestReplyHandler extends PhabricatorMailReplyHandler {
|
||||||
$task = $event->getValue('task');
|
$task = $event->getValue('task');
|
||||||
$xactions = $event->getValue('transactions');
|
$xactions = $event->getValue('transactions');
|
||||||
|
|
||||||
$editor = id(new ManiphestTransactionEditorPro())
|
$editor = id(new ManiphestTransactionEditor())
|
||||||
->setActor($user)
|
->setActor($user)
|
||||||
->setParentMessageID($mail->getMessageID())
|
->setParentMessageID($mail->getMessageID())
|
||||||
->setExcludeMailRecipientPHIDs($this->getExcludeMailRecipientPHIDs())
|
->setExcludeMailRecipientPHIDs($this->getExcludeMailRecipientPHIDs())
|
||||||
|
|
|
@ -27,9 +27,9 @@ final class ManiphestTaskMailReceiver extends PhabricatorObjectMailReceiver {
|
||||||
PhabricatorLiskDAO $object,
|
PhabricatorLiskDAO $object,
|
||||||
PhabricatorUser $sender) {
|
PhabricatorUser $sender) {
|
||||||
|
|
||||||
$editor = new ManiphestTransactionEditor();
|
$handler = PhabricatorEnv::newObjectFromConfig(
|
||||||
$editor->setActor($sender);
|
'metamta.maniphest.reply-handler');
|
||||||
$handler = $editor->buildReplyHandler($object);
|
$handler->setMailReceiver($object);
|
||||||
|
|
||||||
$handler->setActor($sender);
|
$handler->setActor($sender);
|
||||||
$handler->setExcludeMailRecipientPHIDs(
|
$handler->setExcludeMailRecipientPHIDs(
|
||||||
|
|
|
@ -158,7 +158,7 @@ final class PhabricatorSearchAttachController
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
$editor = id(new ManiphestTransactionEditorPro())
|
$editor = id(new ManiphestTransactionEditor())
|
||||||
->setActor($user)
|
->setActor($user)
|
||||||
->setContentSourceFromRequest($this->getRequest())
|
->setContentSourceFromRequest($this->getRequest())
|
||||||
->setContinueOnNoEffect(true)
|
->setContinueOnNoEffect(true)
|
||||||
|
|
Loading…
Reference in a new issue