Changeset View
Changeset View
Standalone View
Standalone View
src/applications/herald/xaction/HeraldWebhookStatusTransaction.php
<?php | <?php | ||||
final class HeraldWebhookStatusTransaction | final class HeraldWebhookStatusTransaction | ||||
extends HeraldWebhookTransactionType { | extends HeraldWebhookTransactionType { | ||||
const TRANSACTIONTYPE = 'status'; | const TRANSACTIONTYPE = 'status'; | ||||
public function generateOldValue($object) { | public function generateOldValue($object) { | ||||
return $object->getStatus(); | return $object->getStatus(); | ||||
} | } | ||||
public function applyInternalEffects($object, $value) { | public function applyInternalEffects($object, $value) { | ||||
$object->setStatus($value); | $object->setStatus($value); | ||||
} | } | ||||
public function getTitle() { | public function getTitle() { | ||||
$old_value = $this->getOldValue(); | |||||
$new_value = $this->getNewValue(); | |||||
$old_status = HeraldWebhook::getDisplayNameForStatus($old_value); | |||||
$new_status = HeraldWebhook::getDisplayNameForStatus($new_value); | |||||
return pht( | return pht( | ||||
'%s changed hook status from %s to %s.', | '%s changed hook status from %s to %s.', | ||||
$this->renderAuthor(), | $this->renderAuthor(), | ||||
$this->renderOldValue(), | $this->renderValue($old_status), | ||||
$this->renderNewValue()); | $this->renderValue($new_status)); | ||||
} | } | ||||
public function getTitleForFeed() { | public function getTitleForFeed() { | ||||
$old_value = $this->getOldValue(); | |||||
$new_value = $this->getNewValue(); | |||||
$old_status = HeraldWebhook::getDisplayNameForStatus($old_value); | |||||
$new_status = HeraldWebhook::getDisplayNameForStatus($new_value); | |||||
return pht( | return pht( | ||||
'%s changed %s from %s to %s.', | '%s changed %s from %s to %s.', | ||||
$this->renderAuthor(), | $this->renderAuthor(), | ||||
$this->renderObject(), | $this->renderObject(), | ||||
$this->renderOldValue(), | $this->renderValue($old_status), | ||||
$this->renderNewValue()); | $this->renderValue($new_status)); | ||||
} | } | ||||
public function validateTransactions($object, array $xactions) { | public function validateTransactions($object, array $xactions) { | ||||
$errors = array(); | $errors = array(); | ||||
$viewer = $this->getActor(); | $viewer = $this->getActor(); | ||||
$options = HeraldWebhook::getStatusDisplayNameMap(); | $options = HeraldWebhook::getStatusDisplayNameMap(); | ||||
Show All 17 Lines |