Differential D21843 Diff 52062 src/applications/slowvote/xaction/PhabricatorSlowvoteResponsesTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/slowvote/xaction/PhabricatorSlowvoteResponsesTransaction.php
<?php | <?php | ||||
final class PhabricatorSlowvoteResponsesTransaction | final class PhabricatorSlowvoteResponsesTransaction | ||||
extends PhabricatorSlowvoteTransactionType { | extends PhabricatorSlowvoteTransactionType { | ||||
const TRANSACTIONTYPE = 'vote:responses'; | const TRANSACTIONTYPE = 'vote:responses'; | ||||
public function generateOldValue($object) { | public function generateOldValue($object) { | ||||
return (int)$object->getResponseVisibility(); | return $object->getResponseVisibility(); | ||||
} | } | ||||
public function applyInternalEffects($object, $value) { | public function applyInternalEffects($object, $value) { | ||||
$object->setResponseVisibility($value); | $object->setResponseVisibility($value); | ||||
} | } | ||||
public function getTitle() { | public function getTitle() { | ||||
// TODO: This could be more detailed | $old_name = $this->getOldResponseVisibilityObject()->getName(); | ||||
$new_name = $this->getNewResponseVisibilityObject()->getName(); | |||||
return pht( | return pht( | ||||
'%s changed who can see the responses.', | '%s changed who can see the responses from %s to %s.', | ||||
$this->renderAuthor()); | $this->renderAuthor(), | ||||
$this->renderValue($old_name), | |||||
$this->renderValue($new_name)); | |||||
} | } | ||||
public function getTitleForFeed() { | public function getTitleForFeed() { | ||||
// TODO: This could be more detailed | $old_name = $this->getOldResponseVisibilityObject()->getName(); | ||||
$new_name = $this->getNewResponseVisibilityObject()->getName(); | |||||
return pht( | return pht( | ||||
'%s changed who can see the responses of %s.', | '%s changed who can see the responses of %s from %s to %s.', | ||||
$this->renderAuthor(), | $this->renderAuthor(), | ||||
$this->renderObject()); | $this->renderObject(), | ||||
$this->renderValue($old_name), | |||||
$this->renderValue($new_name)); | |||||
} | |||||
private function getOldResponseVisibilityObject() { | |||||
return $this->newResponseVisibilityObject($this->getOldValue()); | |||||
} | |||||
private function getNewResponseVisibilityObject() { | |||||
return $this->newResponseVisibilityObject($this->getNewValue()); | |||||
} | |||||
private function newResponseVisibilityObject($value) { | |||||
return SlowvotePollResponseVisibility::newResponseVisibilityObject($value); | |||||
} | } | ||||
} | } |