public function getTitle()
 {
     $author_phid = $this->getAuthorPHID();
     $author_handle = $this->renderHandleLink($author_phid);
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     switch ($this->getTransactionType()) {
         case self::TYPE_INLINE:
             return pht('%s added inline comments.', $author_handle);
         case self::TYPE_UPDATE:
             if ($this->getMetadataValue('isCommitUpdate')) {
                 return pht('This revision was automatically updated to reflect the ' . 'committed changes.');
             } else {
                 if ($new) {
                     // TODO: Migrate to PHIDs and use handles here?
                     if (phid_get_type($new) == DifferentialDiffPHIDType::TYPECONST) {
                         return pht('%s updated this revision to %s.', $author_handle, $this->renderHandleLink($new));
                     } else {
                         return pht('%s updated this revision.', $author_handle);
                     }
                 } else {
                     return pht('%s updated this revision.', $author_handle);
                 }
             }
         case self::TYPE_ACTION:
             switch ($new) {
                 case DifferentialAction::ACTION_CLOSE:
                     if (!$this->getMetadataValue('isCommitClose')) {
                         return DifferentialAction::getBasicStoryText($new, $author_handle);
                     }
                     $commit_name = $this->renderHandleLink($this->getMetadataValue('commitPHID'));
                     $committer_phid = $this->getMetadataValue('committerPHID');
                     $author_phid = $this->getMetadataValue('authorPHID');
                     if ($this->getHandleIfExists($committer_phid)) {
                         $committer_name = $this->renderHandleLink($committer_phid);
                     } else {
                         $committer_name = $this->getMetadataValue('committerName');
                     }
                     if ($this->getHandleIfExists($author_phid)) {
                         $author_name = $this->renderHandleLink($author_phid);
                     } else {
                         $author_name = $this->getMetadataValue('authorName');
                     }
                     if ($committer_name && $committer_name != $author_name) {
                         return pht('Closed by commit %s (authored by %s, committed by %s).', $commit_name, $author_name, $committer_name);
                     } else {
                         return pht('Closed by commit %s (authored by %s).', $commit_name, $author_name);
                     }
                     break;
                 default:
                     return DifferentialAction::getBasicStoryText($new, $author_handle);
             }
             break;
         case self::TYPE_STATUS:
             switch ($this->getNewValue()) {
                 case ArcanistDifferentialRevisionStatus::ACCEPTED:
                     return pht('This revision is now accepted and ready to land.');
                 case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
                     return pht('This revision now requires changes to proceed.');
                 case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
                     return pht('This revision now requires review to proceed.');
             }
     }
     return parent::getTitle();
 }
 public function renderForAsanaBridge($implied_context = false)
 {
     $data = $this->getStoryData();
     $comment = $data->getValue('feedback_content');
     $author_name = $this->getHandle($this->getAuthorPHID())->getName();
     $action = $this->getValue('action');
     $engine = PhabricatorMarkupEngine::newMarkupEngine(array())->setConfig('viewer', new PhabricatorUser())->setMode(PhutilRemarkupEngine::MODE_TEXT);
     $revision_phid = $this->getPrimaryObjectPHID();
     $revision_name = $this->getHandle($revision_phid)->getFullName();
     if ($implied_context) {
         $title = DifferentialAction::getBasicStoryText($action, $author_name);
     } else {
         switch ($action) {
             case DifferentialAction::ACTION_COMMENT:
                 $title = pht('%s commented on revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_ACCEPT:
                 $title = pht('%s accepted revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_REJECT:
                 $title = pht('%s requested changes to revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_RETHINK:
                 $title = pht('%s planned changes to revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_ABANDON:
                 $title = pht('%s abandoned revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_CLOSE:
                 $title = pht('%s closed revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_REQUEST:
                 $title = pht('%s requested a review of revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_RECLAIM:
                 $title = pht('%s reclaimed revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_UPDATE:
                 $title = pht('%s updated revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_RESIGN:
                 $title = pht('%s resigned from revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_SUMMARIZE:
                 $title = pht('%s summarized revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_TESTPLAN:
                 $title = pht('%s explained the test plan for revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_CREATE:
                 $title = pht('%s created revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_ADDREVIEWERS:
                 $title = pht('%s added reviewers to revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_ADDCCS:
                 $title = pht('%s added CCs to revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_CLAIM:
                 $title = pht('%s commandeered revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_REOPEN:
                 $title = pht('%s reopened revision %s', $author_name, $revision_name);
                 break;
             case DifferentialTransaction::TYPE_INLINE:
                 $title = pht('%s added inline comments to %s', $author_name, $revision_name);
                 break;
             default:
                 $title = pht('%s edited revision %s', $author_name, $revision_name);
                 break;
         }
     }
     if (strlen($comment)) {
         $comment = $engine->markupText($comment);
         $title .= "\n\n";
         $title .= $comment;
     }
     // Roughly render inlines into the comment.
     $xaction_phids = $data->getValue('temporaryTransactionPHIDs');
     if ($xaction_phids) {
         $inlines = id(new DifferentialTransactionQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withPHIDs($xaction_phids)->needComments(true)->withTransactionTypes(array(DifferentialTransaction::TYPE_INLINE))->execute();
         if ($inlines) {
             $title .= "\n\n";
             $title .= pht('Inline Comments');
             $title .= "\n";
             $changeset_ids = array();
             foreach ($inlines as $inline) {
                 $changeset_ids[] = $inline->getComment()->getChangesetID();
             }
             $changesets = id(new DifferentialChangeset())->loadAllWhere('id IN (%Ld)', $changeset_ids);
             foreach ($inlines as $inline) {
                 $comment = $inline->getComment();
                 $changeset = idx($changesets, $comment->getChangesetID());
                 if (!$changeset) {
                     continue;
                 }
                 $filename = $changeset->getDisplayFilename();
                 $linenumber = $comment->getLineNumber();
                 $inline_text = $engine->markupText($comment->getContent());
                 $inline_text = rtrim($inline_text);
                 $title .= "{$filename}:{$linenumber} {$inline_text}\n";
             }
         }
     }
     return $title;
 }
 public function getTitle()
 {
     $author_phid = $this->getAuthorPHID();
     $author_handle = $this->renderHandleLink($author_phid);
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     switch ($this->getTransactionType()) {
         case self::TYPE_INLINE:
             return pht('%s added inline comments.', $author_handle);
         case self::TYPE_UPDATE:
             if ($new) {
                 // TODO: Migrate to PHIDs and use handles here?
                 if (phid_get_type($new) == DifferentialDiffPHIDType::TYPECONST) {
                     return pht('%s updated this revision to %s.', $author_handle, $this->renderHandleLink($new));
                 } else {
                     return pht('%s updated this revision.', $author_handle);
                 }
             } else {
                 return pht('%s updated this revision.', $author_handle);
             }
         case self::TYPE_ACTION:
             return DifferentialAction::getBasicStoryText($new, $author_handle);
         case self::TYPE_STATUS:
             switch ($this->getNewValue()) {
                 case ArcanistDifferentialRevisionStatus::ACCEPTED:
                     return pht('This revision is now accepted and ready to land.');
                 case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
                     return pht('This revision now requires changes to proceed.');
                 case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
                     return pht('This revision now requires review to proceed.');
             }
     }
     return parent::getTitle();
 }