Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/diff/PhabricatorInlineCommentController.php
Show First 20 Lines • Show All 180 Lines • ▼ Show 20 Lines | switch ($op) { | ||||
return $this->buildEmptyResponse(); | return $this->buildEmptyResponse(); | ||||
case 'edit': | case 'edit': | ||||
case 'save': | case 'save': | ||||
$inline = $this->loadCommentByIDForEdit($this->getCommentID()); | $inline = $this->loadCommentByIDForEdit($this->getCommentID()); | ||||
if ($op === 'save') { | if ($op === 'save') { | ||||
$this->updateCommentContentState($inline); | $this->updateCommentContentState($inline); | ||||
$inline->setIsEditing(false); | $inline | ||||
->setIsEditing(false) | |||||
if (!$inline->isVoidComment($viewer)) { | ->setIsDeleted(0); | ||||
$inline->setIsDeleted(0); | |||||
$this->saveComment($inline); | $this->saveComment($inline); | ||||
return $this->buildRenderedCommentResponse( | return $this->buildRenderedCommentResponse( | ||||
$inline, | $inline, | ||||
$this->getIsOnRight()); | $this->getIsOnRight()); | ||||
} else { | } else { | ||||
$inline->setIsDeleted(1); | |||||
$this->saveComment($inline); | |||||
return $this->buildEmptyResponse(); | |||||
} | |||||
} else { | |||||
// NOTE: At time of writing, the "editing" state of inlines is | // NOTE: At time of writing, the "editing" state of inlines is | ||||
// preserved by simulating a click on "Edit" when the inline loads. | // preserved by simulating a click on "Edit" when the inline loads. | ||||
// In this case, we don't want to "saveComment()", because it | // In this case, we don't want to "saveComment()", because it | ||||
// recalculates object drafts and purges versioned drafts. | // recalculates object drafts and purges versioned drafts. | ||||
// The recalculation is merely unnecessary (state doesn't change) | // The recalculation is merely unnecessary (state doesn't change) | ||||
// but purging drafts means that loading a page and then closing it | // but purging drafts means that loading a page and then closing it | ||||
▲ Show 20 Lines • Show All 382 Lines • Show Last 20 Lines |