Differential D17120 Diff 41177 src/applications/differential/editor/DifferentialRevisionEditEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/editor/DifferentialRevisionEditEngine.php
| Show First 20 Lines • Show All 256 Lines • ▼ Show 20 Lines | protected function newAutomaticCommentTransactions($object) { | ||||
| $inlines = msort($inlines, 'getID'); | $inlines = msort($inlines, 'getID'); | ||||
| foreach ($inlines as $inline) { | foreach ($inlines as $inline) { | ||||
| $xactions[] = id(new DifferentialTransaction()) | $xactions[] = id(new DifferentialTransaction()) | ||||
| ->setTransactionType(DifferentialTransaction::TYPE_INLINE) | ->setTransactionType(DifferentialTransaction::TYPE_INLINE) | ||||
| ->attachComment($inline); | ->attachComment($inline); | ||||
| } | } | ||||
| $viewer_phid = $viewer->getPHID(); | |||||
| $viewer_is_author = ($object->getAuthorPHID() == $viewer_phid); | |||||
| if ($viewer_is_author) { | |||||
| $state_map = PhabricatorTransactions::getInlineStateMap(); | |||||
| $inlines = id(new DifferentialDiffInlineCommentQuery()) | |||||
| ->setViewer($viewer) | |||||
| ->withRevisionPHIDs(array($object->getPHID())) | |||||
| ->withFixedStates(array_keys($state_map)) | |||||
| ->execute(); | |||||
| if ($inlines) { | |||||
| $old_value = mpull($inlines, 'getFixedState', 'getPHID'); | |||||
| $new_value = array(); | |||||
| foreach ($old_value as $key => $state) { | |||||
| $new_value[$key] = $state_map[$state]; | |||||
| } | |||||
| $xactions[] = id(new DifferentialTransaction()) | |||||
| ->setTransactionType(PhabricatorTransactions::TYPE_INLINESTATE) | |||||
| ->setIgnoreOnNoEffect(true) | |||||
| ->setOldValue($old_value) | |||||
| ->setNewValue($new_value); | |||||
| } | |||||
| } | |||||
| return $xactions; | return $xactions; | ||||
| } | } | ||||
| protected function newCommentPreviewContent($object, array $xactions) { | protected function newCommentPreviewContent($object, array $xactions) { | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $type_inline = DifferentialTransaction::TYPE_INLINE; | $type_inline = DifferentialTransaction::TYPE_INLINE; | ||||
| $inlines = array(); | $inlines = array(); | ||||
| Show All 26 Lines | |||||