Changeset View
Changeset View
Standalone View
Standalone View
src/applications/audit/storage/PhabricatorAuditTransaction.php
| <?php | <?php | ||||
| final class PhabricatorAuditTransaction | final class PhabricatorAuditTransaction | ||||
| extends PhabricatorApplicationTransaction { | extends PhabricatorApplicationTransaction { | ||||
| const TYPE_COMMIT = 'audit:commit'; | const TYPE_COMMIT = 'audit:commit'; | ||||
| const TYPE_INLINEDONE = 'audit:inlinedone'; | |||||
| const MAILTAG_ACTION_CONCERN = 'audit-action-concern'; | const MAILTAG_ACTION_CONCERN = 'audit-action-concern'; | ||||
| const MAILTAG_ACTION_ACCEPT = 'audit-action-accept'; | const MAILTAG_ACTION_ACCEPT = 'audit-action-accept'; | ||||
| const MAILTAG_ACTION_RESIGN = 'audit-action-resign'; | const MAILTAG_ACTION_RESIGN = 'audit-action-resign'; | ||||
| const MAILTAG_ACTION_CLOSE = 'audit-action-close'; | const MAILTAG_ACTION_CLOSE = 'audit-action-close'; | ||||
| const MAILTAG_ADD_AUDITORS = 'audit-add-auditors'; | const MAILTAG_ADD_AUDITORS = 'audit-add-auditors'; | ||||
| const MAILTAG_ADD_CCS = 'audit-add-ccs'; | const MAILTAG_ADD_CCS = 'audit-add-ccs'; | ||||
| const MAILTAG_COMMENT = 'audit-comment'; | const MAILTAG_COMMENT = 'audit-comment'; | ||||
| ▲ Show 20 Lines • Show All 162 Lines • ▼ Show 20 Lines | switch ($type) { | ||||
| } else { | } else { | ||||
| $title = pht( | $title = pht( | ||||
| '%s committed %s.', | '%s committed %s.', | ||||
| $committer, | $committer, | ||||
| $commit); | $commit); | ||||
| } | } | ||||
| return $title; | return $title; | ||||
| case self::TYPE_INLINEDONE: | |||||
| $done = 0; | |||||
| $undone = 0; | |||||
| foreach ($new as $phid => $state) { | |||||
| if ($state == PhabricatorInlineCommentInterface::STATE_DONE) { | |||||
| $done++; | |||||
| } else { | |||||
| $undone++; | |||||
| } | |||||
| } | |||||
| if ($done && $undone) { | |||||
| return pht( | |||||
| '%s marked %s inline comment(s) as done and %s inline comment(s) '. | |||||
| 'as not done.', | |||||
| $author_handle, | |||||
| new PhutilNumber($done), | |||||
| new PhutilNumber($undone)); | |||||
| } else if ($done) { | |||||
| return pht( | |||||
| '%s marked %s inline comment(s) as done.', | |||||
| $author_handle, | |||||
| new PhutilNumber($done)); | |||||
| } else { | |||||
| return pht( | |||||
| '%s marked %s inline comment(s) as not done.', | |||||
| $author_handle, | |||||
| new PhutilNumber($undone)); | |||||
| } | |||||
| break; | |||||
| case PhabricatorAuditActionConstants::INLINE: | case PhabricatorAuditActionConstants::INLINE: | ||||
| return pht( | return pht( | ||||
| '%s added inline comments.', | '%s added inline comments.', | ||||
| $author_handle); | $author_handle); | ||||
| case PhabricatorAuditActionConstants::ADD_CCS: | case PhabricatorAuditActionConstants::ADD_CCS: | ||||
| if ($add && $rem) { | if ($add && $rem) { | ||||
| return pht( | return pht( | ||||
| ▲ Show 20 Lines • Show All 190 Lines • ▼ Show 20 Lines | switch ($this->getTransactionType()) { | ||||
| case self::TYPE_COMMIT: | case self::TYPE_COMMIT: | ||||
| $data = $this->getNewValue(); | $data = $this->getNewValue(); | ||||
| return $story->renderSummary($data['summary']); | return $story->renderSummary($data['summary']); | ||||
| } | } | ||||
| return parent::getBodyForFeed($story); | return parent::getBodyForFeed($story); | ||||
| } | } | ||||
| public function shouldGenerateOldValue() { | |||||
| switch ($this->getTransactionType()) { | |||||
| case self::TYPE_INLINEDONE: | |||||
| return false; | |||||
| } | |||||
| return parent::shouldGenerateOldValue(); | |||||
| } | |||||
| // TODO: These two mail methods can likely be abstracted by introducing a | // TODO: These two mail methods can likely be abstracted by introducing a | ||||
| // formal concept of "inline comment" transactions. | // formal concept of "inline comment" transactions. | ||||
| public function shouldHideForMail(array $xactions) { | public function shouldHideForMail(array $xactions) { | ||||
| $type_inline = PhabricatorAuditActionConstants::INLINE; | $type_inline = PhabricatorAuditActionConstants::INLINE; | ||||
| switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
| case $type_inline: | case $type_inline: | ||||
| foreach ($xactions as $xaction) { | foreach ($xactions as $xaction) { | ||||
| ▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines | |||||