Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/diff/PhabricatorInlineCommentController.php
| Show First 20 Lines • Show All 290 Lines • ▼ Show 20 Lines | switch ($op) { | ||||
| // We have to synchronize the draft engine after saving a versioned | // We have to synchronize the draft engine after saving a versioned | ||||
| // draft, because taking an inline comment from "no text, no draft" | // draft, because taking an inline comment from "no text, no draft" | ||||
| // to "no text, text in a draft" marks the container object as having | // to "no text, text in a draft" marks the container object as having | ||||
| // a draft. | // a draft. | ||||
| $draft_engine = $this->newDraftEngine(); | $draft_engine = $this->newDraftEngine(); | ||||
| if ($draft_engine) { | if ($draft_engine) { | ||||
| $draft_engine->synchronize(); | $draft_engine->synchronize(); | ||||
| } else { | |||||
| phlog('no draft engine'); | |||||
| } | } | ||||
| return $this->buildEmptyResponse(); | return $this->buildEmptyResponse(); | ||||
| case 'new': | case 'new': | ||||
| case 'reply': | case 'reply': | ||||
| default: | default: | ||||
| // NOTE: We read the values from the client (the display values), not | // NOTE: We read the values from the client (the display values), not | ||||
| // the values from the database (the original values) when replying. | // the values from the database (the original values) when replying. | ||||
| // In particular, when replying to a ghost comment which was moved | // In particular, when replying to a ghost comment which was moved | ||||
| // across diffs and then moved backward to the most recent visible | // across diffs and then moved backward to the most recent visible | ||||
| // line, we want to reply on the display line (which exists), not on | // line, we want to reply on the display line (which exists), not on | ||||
| // the comment's original line (which may not exist in this changeset). | // the comment's original line (which may not exist in this changeset). | ||||
| $is_new = $this->getIsNewFile(); | $is_new = $this->getIsNewFile(); | ||||
| $number = $this->getLineNumber(); | $number = $this->getLineNumber(); | ||||
| $length = $this->getLineLength(); | $length = $this->getLineLength(); | ||||
| $inline = $this->createComment() | $inline = $this->createComment() | ||||
| ->setChangesetID($this->getChangesetID()) | ->setChangesetID($this->getChangesetID()) | ||||
| ->setAuthorPHID($viewer->getPHID()) | ->setAuthorPHID($viewer->getPHID()) | ||||
| ->setIsNewFile($is_new) | ->setIsNewFile($is_new) | ||||
| ->setLineNumber($number) | ->setLineNumber($number) | ||||
| ->setLineLength($length) | ->setLineLength($length) | ||||
| ->setContent($this->getCommentText()) | ->setContent((string)$this->getCommentText()) | ||||
| ->setReplyToCommentPHID($this->getReplyToCommentPHID()) | ->setReplyToCommentPHID($this->getReplyToCommentPHID()) | ||||
| ->setIsEditing(true); | ->setIsEditing(true); | ||||
| $document_engine_key = $request->getStr('documentEngineKey'); | |||||
| if ($document_engine_key !== null) { | |||||
| $inline->setDocumentEngineKey($document_engine_key); | |||||
| } | |||||
| // If you own this object, mark your own inlines as "Done" by default. | // If you own this object, mark your own inlines as "Done" by default. | ||||
| $owner_phid = $this->loadObjectOwnerPHID($inline); | $owner_phid = $this->loadObjectOwnerPHID($inline); | ||||
| if ($owner_phid) { | if ($owner_phid) { | ||||
| if ($viewer->getPHID() == $owner_phid) { | if ($viewer->getPHID() == $owner_phid) { | ||||
| $fixed_state = PhabricatorInlineComment::STATE_DRAFT; | $fixed_state = PhabricatorInlineComment::STATE_DRAFT; | ||||
| $inline->setFixedState($fixed_state); | $inline->setFixedState($fixed_state); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 224 Lines • Show Last 20 Lines | |||||