Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/diff/PhabricatorInlineCommentController.php
| Show First 20 Lines • Show All 303 Lines • ▼ Show 20 Lines | $renderer = DifferentialChangesetHTMLRenderer::getHTMLRendererByKey( | ||||
| $this->getRenderer()); | $this->getRenderer()); | ||||
| $view = $renderer->getRowScaffoldForInline($view); | $view = $renderer->getRowScaffoldForInline($view); | ||||
| return id(new PHUIDiffInlineCommentTableScaffold()) | return id(new PHUIDiffInlineCommentTableScaffold()) | ||||
| ->addRowScaffold($view); | ->addRowScaffold($view); | ||||
| } | } | ||||
| public static function loadAndAttachReplies( | |||||
| PhabricatorUser $viewer, | |||||
| array $comments) { | |||||
| // TODO: This code doesn't really belong here, but we don't have a much | |||||
| // better place to put it at the moment. | |||||
| if (!$comments) { | |||||
| return $comments; | |||||
| } | |||||
| $template = head($comments); | |||||
| $reply_phids = array(); | |||||
| foreach ($comments as $comment) { | |||||
| $reply_phid = $comment->getReplyToCommentPHID(); | |||||
| if ($reply_phid) { | |||||
| $reply_phids[] = $reply_phid; | |||||
| } | |||||
| } | |||||
| if ($reply_phids) { | |||||
| $reply_comments = | |||||
| id(new PhabricatorApplicationTransactionTemplatedCommentQuery()) | |||||
| ->setTemplate($template) | |||||
| ->setViewer($viewer) | |||||
| ->withPHIDs($reply_phids) | |||||
| ->execute(); | |||||
| $reply_comments = mpull($reply_comments, null, 'getPHID'); | |||||
| } else { | |||||
| $reply_comments = array(); | |||||
| } | |||||
| foreach ($comments as $comment) { | |||||
| $reply_phid = $comment->getReplyToCommentPHID(); | |||||
| $reply = idx($reply_comments, $reply_phid); | |||||
| $comment->attachReplyToComment($reply); | |||||
| } | |||||
| return $comments; | |||||
| } | |||||
| } | } | ||||