Differential D17053 Diff 41022 src/applications/transactions/editfield/PhabricatorCommentEditField.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/editfield/PhabricatorCommentEditField.php
| <?php | <?php | ||||
| final class PhabricatorCommentEditField | final class PhabricatorCommentEditField | ||||
| extends PhabricatorEditField { | extends PhabricatorEditField { | ||||
| private $isWebOnly; | |||||
| public function setIsWebOnly($is_web_only) { | |||||
| $this->isWebOnly = $is_web_only; | |||||
| return $this; | |||||
| } | |||||
| public function getIsWebOnly() { | |||||
| return $this->isWebOnly; | |||||
| } | |||||
| protected function newControl() { | protected function newControl() { | ||||
| return new PhabricatorRemarkupControl(); | return new PhabricatorRemarkupControl(); | ||||
| } | } | ||||
| protected function newEditType() { | protected function newEditType() { | ||||
| return new PhabricatorCommentEditType(); | return new PhabricatorCommentEditType(); | ||||
| } | } | ||||
| protected function newConduitParameterType() { | protected function newConduitParameterType() { | ||||
| if ($this->getIsWebOnly()) { | |||||
| return null; | |||||
| } else { | |||||
| return new ConduitStringParameterType(); | return new ConduitStringParameterType(); | ||||
| } | } | ||||
| } | |||||
| public function shouldGenerateTransactionsFromSubmit() { | public function shouldGenerateTransactionsFromSubmit() { | ||||
| return false; | return !$this->isPrimaryCommentField(); | ||||
| } | } | ||||
| public function shouldGenerateTransactionsFromComment() { | public function shouldGenerateTransactionsFromComment() { | ||||
| return true; | return $this->isPrimaryCommentField(); | ||||
| } | |||||
| private function isPrimaryCommentField() { | |||||
| return ($this->getKey() === 'comment'); | |||||
| } | } | ||||
| } | } | ||||