Differential D17830 Diff 42893 src/applications/slowvote/xactions/PhabricatorSlowvoteResponsesTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/slowvote/xactions/PhabricatorSlowvoteResponsesTransaction.php
- This file was added.
<?php | |||||
final class PhabricatorSlowvoteResponsesTransaction | |||||
extends PhabricatorSlowvoteTransactionType { | |||||
const TRANSACTIONTYPE = 'vote:responses'; | |||||
public function generateOldValue($object) { | |||||
return (int)$object->getResponseVisibility(); | |||||
} | |||||
public function applyInternalEffects($object, $value) { | |||||
epriestley: I //think// you should be able to omit this case and just return the `(int)` cast if you also… | |||||
$object->setResponseVisibility($value); | |||||
} | |||||
public function getTitle() { | |||||
// TODO: This could be more detailed | |||||
Done Inline Actions(Stray debugging code.) epriestley: (Stray debugging code.) | |||||
return pht( | |||||
'%s changed who can see the responses.', | |||||
$this->renderAuthor()); | |||||
} | |||||
public function getTitleForFeed() { | |||||
// TODO: This could be more detailed | |||||
return pht( | |||||
'%s changed who can see the responses of %s.', | |||||
$this->renderAuthor(), | |||||
$this->renderObject()); | |||||
} | |||||
} | |||||
Done Inline ActionsOmit. epriestley: Omit. |
I think you should be able to omit this case and just return the (int) cast if you also set the response visibility to a valid value by default, which is generally desirable anyway. You can do this in initializeNewPoll() if the best default is complex, or just in protected $responseVisibility = ...; for simple values.