protected function saveComment(PhabricatorInlineCommentInterface $inline) { $inline->openTransaction(); $inline->save(); DifferentialDraft::markHasDraft($inline->getAuthorPHID(), $inline->getRevisionPHID(), $inline->getPHID()); $inline->saveTransaction(); }
public static function renderCommentContent(PhabricatorInlineCommentInterface $inline, PhutilMarkupEngine $engine) { $inline_content = $inline->getContent(); if (strlen($inline_content)) { $inline_cache = $inline->getCache(); if ($inline_cache) { $inline_content = $inline_cache; } else { $inline_content = $engine->markupText($inline_content); if ($inline->getID()) { $inline->setCache($inline_content); $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); $inline->save(); unset($unguarded); } } } return $inline_content; }
public function isCompatible(PhabricatorInlineCommentInterface $comment) { return $this->getAuthorPHID() === $comment->getAuthorPHID() && $this->getSyntheticAuthor() === $comment->getSyntheticAuthor() && $this->getContent() === $comment->getContent(); }
private function renderInlineComment(PhabricatorInlineCommentInterface $comment) { $user = $this->user; $edit = $user && $comment->getAuthorPHID() == $user->getPHID() && $comment->isDraft(); $allow_reply = (bool) $this->user; $on_right = $this->isCommentOnRightSideWhenDisplayed($comment); return id(new DifferentialInlineCommentView())->setInlineComment($comment)->setOnRight($on_right)->setHandles($this->handles)->setMarkupEngine($this->markupEngine)->setEditable($edit)->setAllowReply($allow_reply)->render(); }
protected function buildInlineComment(PhabricatorInlineCommentInterface $comment, $on_right = false) { $user = $this->getUser(); $edit = $user && $comment->getAuthorPHID() == $user->getPHID() && $comment->isDraft() && $this->getShowEditAndReplyLinks(); $allow_reply = (bool) $user && $this->getShowEditAndReplyLinks(); $allow_done = !$comment->isDraft() && $this->getCanMarkDone(); return id(new PHUIDiffInlineCommentDetailView())->setUser($user)->setInlineComment($comment)->setIsOnRight($on_right)->setHandles($this->getHandles())->setMarkupEngine($this->getMarkupEngine())->setEditable($edit)->setAllowReply($allow_reply)->setCanMarkDone($allow_done)->setObjectOwnerPHID($this->getObjectOwnerPHID()); }
protected function buildInlineComment(PhabricatorInlineCommentInterface $comment, $on_right = false) { $user = $this->getUser(); $edit = $user && $comment->getAuthorPHID() == $user->getPHID() && $comment->isDraft(); $allow_reply = (bool) $user; return id(new DifferentialInlineCommentView())->setInlineComment($comment)->setOnRight($on_right)->setHandles($this->getHandles())->setMarkupEngine($this->getMarkupEngine())->setEditable($edit)->setAllowReply($allow_reply); }
/** * Determine if an inline comment will appear on the rendered diff, * taking into consideration which halves of which changesets will actually * be shown. * * @param PhabricatorInlineCommentInterface Comment to test for visibility. * @return bool True if the comment is visible on the rendered diff. */ private function isCommentVisibleOnRenderedDiff(PhabricatorInlineCommentInterface $comment) { $changeset_id = $comment->getChangesetID(); $is_new = $comment->getIsNewFile(); if ($changeset_id == $this->rightSideChangesetID && $is_new == $this->rightSideAttachesToNewFile) { return true; } if ($changeset_id == $this->leftSideChangesetID && $is_new == $this->leftSideAttachesToNewFile) { return true; } return false; }
protected function saveComment(PhabricatorInlineCommentInterface $inline) { return $inline->save(); }