Changeset View
Changeset View
Standalone View
Standalone View
src/applications/ponder/storage/PonderQuestionTransaction.php
| <?php | <?php | ||||
| final class PonderQuestionTransaction | final class PonderQuestionTransaction | ||||
| extends PhabricatorApplicationTransaction { | extends PhabricatorApplicationTransaction { | ||||
| const TYPE_TITLE = 'ponder.question:question'; | const TYPE_TITLE = 'ponder.question:question'; | ||||
| const TYPE_CONTENT = 'ponder.question:content'; | const TYPE_CONTENT = 'ponder.question:content'; | ||||
| const TYPE_ANSWERS = 'ponder.question:answer'; | const TYPE_ANSWERS = 'ponder.question:answer'; | ||||
| const TYPE_STATUS = 'ponder.question:status'; | const TYPE_STATUS = 'ponder.question:status'; | ||||
| const TYPE_ANSWERWIKI = 'ponder.question:wiki'; | |||||
| const MAILTAG_DETAILS = 'question:details'; | const MAILTAG_DETAILS = 'question:details'; | ||||
| const MAILTAG_COMMENT = 'question:comment'; | const MAILTAG_COMMENT = 'question:comment'; | ||||
| const MAILTAG_ANSWERS = 'question:answer'; | const MAILTAG_ANSWERS = 'question:answer'; | ||||
| const MAILTAG_OTHER = 'question:other'; | const MAILTAG_OTHER = 'question:other'; | ||||
| public function getApplicationName() { | public function getApplicationName() { | ||||
| return 'ponder'; | return 'ponder'; | ||||
| ▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | switch ($this->getTransactionType()) { | ||||
| $this->renderHandleLink($author_phid), | $this->renderHandleLink($author_phid), | ||||
| $old, | $old, | ||||
| $new); | $new); | ||||
| } | } | ||||
| case self::TYPE_CONTENT: | case self::TYPE_CONTENT: | ||||
| return pht( | return pht( | ||||
| '%s edited the question description.', | '%s edited the question description.', | ||||
| $this->renderHandleLink($author_phid)); | $this->renderHandleLink($author_phid)); | ||||
| case self::TYPE_ANSWERWIKI: | |||||
| return pht( | |||||
| '%s edited the question answer wiki.', | |||||
| $this->renderHandleLink($author_phid)); | |||||
| case self::TYPE_ANSWERS: | case self::TYPE_ANSWERS: | ||||
| $answer_handle = $this->getHandle($this->getNewAnswerPHID()); | $answer_handle = $this->getHandle($this->getNewAnswerPHID()); | ||||
| $question_handle = $this->getHandle($object_phid); | $question_handle = $this->getHandle($object_phid); | ||||
| return pht( | return pht( | ||||
| '%s answered %s', | '%s answered %s', | ||||
| $this->renderHandleLink($author_phid), | $this->renderHandleLink($author_phid), | ||||
| $this->renderHandleLink($object_phid)); | $this->renderHandleLink($object_phid)); | ||||
| Show All 26 Lines | public function getMailTags() { | ||||
| switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
| case PhabricatorTransactions::TYPE_COMMENT: | case PhabricatorTransactions::TYPE_COMMENT: | ||||
| $tags[] = self::MAILTAG_COMMENT; | $tags[] = self::MAILTAG_COMMENT; | ||||
| break; | break; | ||||
| case self::TYPE_TITLE: | case self::TYPE_TITLE: | ||||
| case self::TYPE_CONTENT: | case self::TYPE_CONTENT: | ||||
| case self::TYPE_STATUS: | case self::TYPE_STATUS: | ||||
| case self::TYPE_ANSWERWIKI: | |||||
| $tags[] = self::MAILTAG_DETAILS; | $tags[] = self::MAILTAG_DETAILS; | ||||
| break; | break; | ||||
| case self::TYPE_ANSWERS: | case self::TYPE_ANSWERS: | ||||
| $tags[] = self::MAILTAG_ANSWERS; | $tags[] = self::MAILTAG_ANSWERS; | ||||
| break; | break; | ||||
| default: | default: | ||||
| $tags[] = self::MAILTAG_OTHER; | $tags[] = self::MAILTAG_OTHER; | ||||
| break; | break; | ||||
| } | } | ||||
| return $tags; | return $tags; | ||||
| } | } | ||||
| public function getIcon() { | public function getIcon() { | ||||
| $old = $this->getOldValue(); | $old = $this->getOldValue(); | ||||
| $new = $this->getNewValue(); | $new = $this->getNewValue(); | ||||
| switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
| case self::TYPE_TITLE: | case self::TYPE_TITLE: | ||||
| case self::TYPE_CONTENT: | case self::TYPE_CONTENT: | ||||
| case self::TYPE_ANSWERWIKI: | |||||
| return 'fa-pencil'; | return 'fa-pencil'; | ||||
| case self::TYPE_STATUS: | case self::TYPE_STATUS: | ||||
| return PonderQuestionStatus::getQuestionStatusIcon($new); | return PonderQuestionStatus::getQuestionStatusIcon($new); | ||||
| case self::TYPE_ANSWERS: | case self::TYPE_ANSWERS: | ||||
| return 'fa-plus'; | return 'fa-plus'; | ||||
| } | } | ||||
| return parent::getIcon(); | return parent::getIcon(); | ||||
| } | } | ||||
| public function getColor() { | public function getColor() { | ||||
| $old = $this->getOldValue(); | $old = $this->getOldValue(); | ||||
| $new = $this->getNewValue(); | $new = $this->getNewValue(); | ||||
| switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
| case self::TYPE_TITLE: | case self::TYPE_TITLE: | ||||
| case self::TYPE_CONTENT: | case self::TYPE_CONTENT: | ||||
| case self::TYPE_ANSWERWIKI: | |||||
| return PhabricatorTransactions::COLOR_BLUE; | return PhabricatorTransactions::COLOR_BLUE; | ||||
| case self::TYPE_ANSWERS: | case self::TYPE_ANSWERS: | ||||
| return PhabricatorTransactions::COLOR_GREEN; | return PhabricatorTransactions::COLOR_GREEN; | ||||
| case self::TYPE_STATUS: | case self::TYPE_STATUS: | ||||
| return PonderQuestionStatus::getQuestionStatusTagColor($new); | return PonderQuestionStatus::getQuestionStatusTagColor($new); | ||||
| } | } | ||||
| } | } | ||||
| public function hasChangeDetails() { | public function hasChangeDetails() { | ||||
| switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
| case self::TYPE_CONTENT: | case self::TYPE_CONTENT: | ||||
| case self::TYPE_ANSWERWIKI: | |||||
epriestley: ANSWERWIKI should probably be here too so users can get a dialog with diffs when the thing is… | |||||
| return true; | return true; | ||||
| } | } | ||||
| return parent::hasChangeDetails(); | return parent::hasChangeDetails(); | ||||
| } | } | ||||
| public function renderChangeDetails(PhabricatorUser $viewer) { | public function renderChangeDetails(PhabricatorUser $viewer) { | ||||
| return $this->renderTextCorpusChangeDetails( | return $this->renderTextCorpusChangeDetails( | ||||
| $viewer, | $viewer, | ||||
| ▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | switch ($this->getTransactionType()) { | ||||
| $this->renderHandleLink($object_phid), | $this->renderHandleLink($object_phid), | ||||
| $old); | $old); | ||||
| } | } | ||||
| case self::TYPE_CONTENT: | case self::TYPE_CONTENT: | ||||
| return pht( | return pht( | ||||
| '%s edited the description of %s', | '%s edited the description of %s', | ||||
| $this->renderHandleLink($author_phid), | $this->renderHandleLink($author_phid), | ||||
| $this->renderHandleLink($object_phid)); | $this->renderHandleLink($object_phid)); | ||||
| case self::TYPE_ANSWERWIKI: | |||||
| return pht( | |||||
| '%s edited the answer wiki for %s', | |||||
| $this->renderHandleLink($author_phid), | |||||
| $this->renderHandleLink($object_phid)); | |||||
| case self::TYPE_ANSWERS: | case self::TYPE_ANSWERS: | ||||
| $answer_handle = $this->getHandle($this->getNewAnswerPHID()); | $answer_handle = $this->getHandle($this->getNewAnswerPHID()); | ||||
| $question_handle = $this->getHandle($object_phid); | $question_handle = $this->getHandle($object_phid); | ||||
| return pht( | return pht( | ||||
| '%s answered %s', | '%s answered %s', | ||||
| $this->renderHandleLink($author_phid), | $this->renderHandleLink($author_phid), | ||||
| $answer_handle->renderLink($question_handle->getFullName())); | $answer_handle->renderLink($question_handle->getFullName())); | ||||
| case self::TYPE_STATUS: | case self::TYPE_STATUS: | ||||
| ▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines | |||||
ANSWERWIKI should probably be here too so users can get a dialog with diffs when the thing is edited.