mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-01 03:02:43 +01:00
aa7ba4c6e6
Summary: Ref T3886. Now that a custom field can emit a core transaction, just emit a subscribers transaction. Test Plan: {F116014} Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T3886 Differential Revision: https://secure.phabricator.com/D8289
49 lines
1.2 KiB
PHP
49 lines
1.2 KiB
PHP
<?php
|
|
|
|
final class DifferentialSubscribersField
|
|
extends DifferentialCoreCustomField {
|
|
|
|
public function getFieldKey() {
|
|
return 'differential:subscribers';
|
|
}
|
|
|
|
public function getFieldName() {
|
|
return pht('Subscribers');
|
|
}
|
|
|
|
public function getFieldDescription() {
|
|
return pht('Manage subscribers.');
|
|
}
|
|
|
|
protected function readValueFromRevision(
|
|
DifferentialRevision $revision) {
|
|
return PhabricatorSubscribersQuery::loadSubscribersForPHID(
|
|
$revision->getPHID());
|
|
}
|
|
|
|
public function getNewValueForApplicationTransactions() {
|
|
return array('=' => $this->getValue());
|
|
}
|
|
|
|
public function readValueFromRequest(AphrontRequest $request) {
|
|
$this->setValue($request->getArr($this->getFieldKey()));
|
|
}
|
|
|
|
public function getRequiredHandlePHIDsForEdit() {
|
|
return $this->getValue();
|
|
}
|
|
|
|
public function renderEditControl(array $handles) {
|
|
return id(new AphrontFormTokenizerControl())
|
|
->setName($this->getFieldKey())
|
|
->setDatasource('/typeahead/common/mailable/')
|
|
->setValue($handles)
|
|
->setError($this->getFieldError())
|
|
->setLabel($this->getFieldName());
|
|
}
|
|
|
|
public function getApplicationTransactionType() {
|
|
return PhabricatorTransactions::TYPE_SUBSCRIBERS;
|
|
}
|
|
|
|
}
|