mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
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
This commit is contained in:
parent
ed7a5078f9
commit
01eedd6e6a
4 changed files with 80 additions and 50 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue