Commit 01eedd6e authored by epriestley's avatar epriestley
Browse files

Make ManiphestCustomField actually implement the interface it ostensibly exposes

Summary: There's a bunch of stuff that lives only in AuxiliaryField which is called on objects which may be ManiphestCustomFields right now. This is basically a list of remaining API methods which need to be moved to the new stuff. This enables construction of new-style custom fields.

Test Plan: Created a sophisticated Maniphest custom field.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D7013
parent ed7a5078
......@@ -88,55 +88,6 @@ abstract class ManiphestAuxiliaryFieldSpecification
return $this->getValue();
}
/**
* Render a verb to appear in email titles when a transaction involving this
* field occurs. Specifically, Maniphest emails are formatted like this:
*
* [Maniphest] [Verb Here] TNNN: Task title here
* ^^^^^^^^^
*
* You should optionally return a title-case verb or short phrase like
* "Created", "Retitled", "Closed", "Resolved", "Commented On",
* "Lowered Priority", etc., which describes the transaction.
*
* @param ManiphestTransaction The transaction which needs description.
* @return string|null A short description of the transaction.
*/
public function renderTransactionEmailVerb(
ManiphestTransaction $transaction) {
return null;
}
/**
* Render a short description of the transaction, to appear above comments
* in the Maniphest transaction log. The string will be rendered after the
* acting user's name. Examples are:
*
* added a comment
* added alincoln to CC
* claimed this task
* created this task
* closed this task out of spite
*
* You should return a similar string, describing the transaction.
*
* Note the ##$target## parameter -- Maniphest needs to render transaction
* descriptions for different targets, like web and email. This method will
* be called with a ##ManiphestAuxiliaryFieldSpecification::RENDER_TARGET_*##
* constant describing the intended target.
*
* @param ManiphestTransaction The transaction which needs description.
* @param const Constant describing the rendering target (e.g., html or text).
* @return string|null Description of the transaction.
*/
public function renderTransactionDescription(
ManiphestTransaction $transaction,
$target) {
return 'updated a custom field';
}
public function getRequiredHandlePHIDs() {
return array();
}
......
......@@ -212,6 +212,13 @@ final class ManiphestTransactionEditor extends PhabricatorEditor {
id(new PhabricatorSearchIndexer())
->indexDocumentByPHID($task->getPHID());
$fields = PhabricatorCustomField::getObjectFields(
$task,
PhabricatorCustomField::ROLE_APPLICATIONSEARCH);
$fields->readFieldsFromStorage($task);
$fields->rebuildIndexes($task);
}
protected function getSubjectPrefix() {
......
......@@ -28,5 +28,77 @@ abstract class ManiphestCustomField
return false;
}
// TODO: All of this is legacy junk.
public function getRequiredHandlePHIDs() {
return array();
}
public function setHandles(array $handles) {
}
public function isRequired() {
return false;
}
public function renderControl() {
return $this->renderEditControl();
}
public function validate() {
return true;
}
/**
* Render a verb to appear in email titles when a transaction involving this
* field occurs. Specifically, Maniphest emails are formatted like this:
*
* [Maniphest] [Verb Here] TNNN: Task title here
* ^^^^^^^^^
*
* You should optionally return a title-case verb or short phrase like
* "Created", "Retitled", "Closed", "Resolved", "Commented On",
* "Lowered Priority", etc., which describes the transaction.
*
* @param ManiphestTransaction The transaction which needs description.
* @return string|null A short description of the transaction.
*/
public function renderTransactionEmailVerb(
ManiphestTransaction $transaction) {
return null;
}
/**
* Render a short description of the transaction, to appear above comments
* in the Maniphest transaction log. The string will be rendered after the
* acting user's name. Examples are:
*
* added a comment
* added alincoln to CC
* claimed this task
* created this task
* closed this task out of spite
*
* You should return a similar string, describing the transaction.
*
* Note the ##$target## parameter -- Maniphest needs to render transaction
* descriptions for different targets, like web and email. This method will
* be called with a ##ManiphestAuxiliaryFieldSpecification::RENDER_TARGET_*##
* constant describing the intended target.
*
* @param ManiphestTransaction The transaction which needs description.
* @param const Constant describing the rendering target (e.g., html or text).
* @return string|null Description of the transaction.
*/
public function renderTransactionDescription(
ManiphestTransaction $transaction,
$target) {
return 'updated a custom field';
}
public function getMarkupFields() {
return array();
}
}
......@@ -20,7 +20,7 @@ final class ManiphestTransactionDetailView extends ManiphestView {
public function setAuxiliaryFields(array $fields) {
assert_instances_of($fields, 'ManiphestCustomField');
$this->auxiliaryFields = mpull($fields, null, 'getAuxiliaryKey');
$this->auxiliaryFields = mpull($fields, null, 'getFieldKey');
return $this;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment