Add inline comments to Diffusion/Audit
Summary: - Add inline comments to Audits, like Differential. - Creates new storage for the comments in the Audits database. - Creates a new PhabricatorAuditInlineComment class, similar to DifferentialInlineComment. - Defines an Interface which Differential and Audit comments conform to. - Makes consumers of DifferentialInlineComments consume objects which implement that interface instead. - Adds save NOTE: Some features are still missing! Wanted to cut this off before it got crazy: - Inline comments aren't shown in the main comment list. - Inline comments aren't shown in the emails. - Inline comments aren't previewed. I'll followup with those but this was getting pretty big. @vrana, does the SQL change look correct? Test Plan: - Created, edited, deleted, replied to, reloaded and saved inline comments in Diffusion, on the left and right side of diffs. - Created, edited, deleted, replied to, reloaded and saved inline comments in Differentila, on the left and right side of primary and diff-versus-diff diffs. Reviewers: btrahan, vrana Reviewed By: btrahan CC: aran, epriestley Maniphest Tasks: T904 Differential Revision: https://secure.phabricator.com/D1898
This commit is contained in:
@@ -250,7 +250,9 @@ final class DifferentialChangesetParser {
|
||||
}
|
||||
}
|
||||
|
||||
public function parseInlineComment(DifferentialInlineComment $comment) {
|
||||
public function parseInlineComment(
|
||||
PhabricatorInlineCommentInterface $comment) {
|
||||
|
||||
// Parse only comments which are actually visible.
|
||||
if ($this->isCommentVisibleOnRenderedDiff($comment)) {
|
||||
$this->comments[] = $comment;
|
||||
@@ -1067,11 +1069,11 @@ final class DifferentialChangesetParser {
|
||||
* taking into consideration which halves of which changesets will actually
|
||||
* be shown.
|
||||
*
|
||||
* @param DifferentialInlineComment Comment to test for visibility.
|
||||
* @param PhabricatorInlineCommentInterface Comment to test for visibility.
|
||||
* @return bool True if the comment is visible on the rendered diff.
|
||||
*/
|
||||
private function isCommentVisibleOnRenderedDiff(
|
||||
DifferentialInlineComment $comment) {
|
||||
PhabricatorInlineCommentInterface $comment) {
|
||||
|
||||
$changeset_id = $comment->getChangesetID();
|
||||
$is_new = $comment->getIsNewFile();
|
||||
@@ -1095,11 +1097,12 @@ final class DifferentialChangesetParser {
|
||||
* Note that the comment must appear somewhere on the rendered changeset, as
|
||||
* per isCommentVisibleOnRenderedDiff().
|
||||
*
|
||||
* @param DifferentialInlineComment Comment to test for display location.
|
||||
* @param PhabricatorInlineCommentInterface Comment to test for display
|
||||
* location.
|
||||
* @return bool True for right, false for left.
|
||||
*/
|
||||
private function isCommentOnRightSideWhenDisplayed(
|
||||
DifferentialInlineComment $comment) {
|
||||
PhabricatorInlineCommentInterface $comment) {
|
||||
|
||||
if (!$this->isCommentVisibleOnRenderedDiff($comment)) {
|
||||
throw new Exception("Comment is not visible on changeset!");
|
||||
@@ -1444,12 +1447,13 @@ final class DifferentialChangesetParser {
|
||||
return implode('', $html);
|
||||
}
|
||||
|
||||
private function renderInlineComment(DifferentialInlineComment $comment) {
|
||||
private function renderInlineComment(
|
||||
PhabricatorInlineCommentInterface $comment) {
|
||||
|
||||
$user = $this->user;
|
||||
$edit = $user &&
|
||||
($comment->getAuthorPHID() == $user->getPHID()) &&
|
||||
(!$comment->getCommentID());
|
||||
($comment->isDraft());
|
||||
|
||||
$on_right = $this->isCommentOnRightSideWhenDisplayed($comment);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user