Path: blob/master/src/applications/differential/xaction/DifferentialRevisionInlineTransaction.php
12256 views
<?php12final class DifferentialRevisionInlineTransaction3extends PhabricatorModularTransactionType {45// NOTE: This class is NOT an actual Differential modular transaction type!6// It does not extend "DifferentialRevisionTransactionType". Some day it7// should, but for now it's just reducing the amount of hackiness around8// supporting inline comments in the "transaction.search" Conduit API method.910const TRANSACTIONTYPE = 'internal.pretend-inline';1112public function getTransactionTypeForConduit($xaction) {13return 'inline';14}1516public function loadTransactionTypeConduitData(array $xactions) {17$viewer = $this->getViewer();1819$changeset_ids = array();20foreach ($xactions as $xaction) {21$changeset_ids[] = $xaction->getComment()->getChangesetID();22}2324$changesets = id(new DifferentialChangesetQuery())25->setViewer($viewer)26->withIDs($changeset_ids)27->execute();2829$changesets = mpull($changesets, null, 'getID');3031return $changesets;32}3334public function getFieldValuesForConduit($object, $data) {35$comment = $object->getComment();3637$changeset = $data[$comment->getChangesetID()];38$diff = $changeset->getDiff();3940$is_done = false;41switch ($comment->getFixedState()) {42case PhabricatorInlineComment::STATE_DONE:43case PhabricatorInlineComment::STATE_UNDRAFT:44$is_done = true;45break;46}4748return array(49'diff' => array(50'id' => (int)$diff->getID(),51'phid' => $diff->getPHID(),52),53'path' => $changeset->getDisplayFilename(),54'line' => (int)$comment->getLineNumber(),55'length' => (int)($comment->getLineLength() + 1),56'replyToCommentPHID' => $comment->getReplyToCommentPHID(),57'isDone' => $is_done,58);59}6061}626364