2014-02-21 20:54:08 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DifferentialSubscribersField
|
|
|
|
extends DifferentialCoreCustomField {
|
|
|
|
|
|
|
|
public function getFieldKey() {
|
|
|
|
return 'differential:subscribers';
|
|
|
|
}
|
|
|
|
|
2014-03-08 02:05:00 +01:00
|
|
|
public function getFieldKeyForConduit() {
|
|
|
|
return 'ccPHIDs';
|
|
|
|
}
|
|
|
|
|
2014-02-21 20:54:08 +01:00
|
|
|
public function getFieldName() {
|
|
|
|
return pht('Subscribers');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getFieldDescription() {
|
|
|
|
return pht('Manage subscribers.');
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function readValueFromRevision(
|
|
|
|
DifferentialRevision $revision) {
|
2014-03-08 02:05:00 +01:00
|
|
|
if (!$revision->getPHID()) {
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
2014-02-21 20:54:08 +01:00
|
|
|
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 renderEditControl(array $handles) {
|
|
|
|
return id(new AphrontFormTokenizerControl())
|
2015-03-31 23:10:55 +02:00
|
|
|
->setUser($this->getViewer())
|
2014-02-21 20:54:08 +01:00
|
|
|
->setName($this->getFieldKey())
|
2014-07-18 00:44:29 +02:00
|
|
|
->setDatasource(new PhabricatorMetaMTAMailableDatasource())
|
2015-03-31 23:10:55 +02:00
|
|
|
->setValue($this->getValue())
|
2014-02-21 20:54:08 +01:00
|
|
|
->setError($this->getFieldError())
|
|
|
|
->setLabel($this->getFieldName());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationTransactionType() {
|
|
|
|
return PhabricatorTransactions::TYPE_SUBSCRIBERS;
|
|
|
|
}
|
|
|
|
|
2014-03-08 02:05:00 +01:00
|
|
|
public function shouldAppearInCommitMessage() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function shouldAllowEditInCommitMessage() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function shouldAppearInCommitMessageTemplate() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCommitMessageLabels() {
|
|
|
|
return array(
|
|
|
|
'CC',
|
|
|
|
'CCs',
|
|
|
|
'Subscriber',
|
|
|
|
'Subscribers',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function parseValueFromCommitMessage($value) {
|
|
|
|
return $this->parseObjectList(
|
|
|
|
$value,
|
|
|
|
array(
|
2014-07-24 00:05:46 +02:00
|
|
|
PhabricatorPeopleUserPHIDType::TYPECONST,
|
|
|
|
PhabricatorProjectProjectPHIDType::TYPECONST,
|
2014-03-08 02:05:00 +01:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getRequiredHandlePHIDsForCommitMessage() {
|
|
|
|
return $this->getValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderCommitMessageValue(array $handles) {
|
|
|
|
return $this->renderObjectList($handles);
|
|
|
|
}
|
|
|
|
|
2014-02-21 20:54:08 +01:00
|
|
|
}
|