Differential D17116 Diff 41173 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 241 Lines • ▼ Show 20 Lines | private function isCustomFieldEnabled(DifferentialRevision $revision, $key) { | ||||
| $field_list = PhabricatorCustomField::getObjectFields( | $field_list = PhabricatorCustomField::getObjectFields( | ||||
| $revision, | $revision, | ||||
| PhabricatorCustomField::ROLE_VIEW); | PhabricatorCustomField::ROLE_VIEW); | ||||
| $fields = $field_list->getFields(); | $fields = $field_list->getFields(); | ||||
| return isset($fields[$key]); | return isset($fields[$key]); | ||||
| } | } | ||||
| protected function newAutomaticCommentTransactions($object) { | |||||
| $viewer = $this->getViewer(); | |||||
| $xactions = array(); | |||||
| $inlines = DifferentialTransactionQuery::loadUnsubmittedInlineComments( | |||||
| $viewer, | |||||
| $object); | |||||
| $inlines = msort($inlines, 'getID'); | |||||
| foreach ($inlines as $inline) { | |||||
| $xactions[] = id(new DifferentialTransaction()) | |||||
| ->setTransactionType(DifferentialTransaction::TYPE_INLINE) | |||||
| ->attachComment($inline); | |||||
| } | |||||
| return $xactions; | |||||
| } | |||||
| protected function newCommentPreviewContent($object, array $xactions) { | |||||
| $viewer = $this->getViewer(); | |||||
| $type_inline = DifferentialTransaction::TYPE_INLINE; | |||||
| $inlines = array(); | |||||
| foreach ($xactions as $xaction) { | |||||
| if ($xaction->getTransactionType() === $type_inline) { | |||||
| $inlines[] = $xaction->getComment(); | |||||
| } | |||||
| } | |||||
| $content = array(); | |||||
| if ($inlines) { | |||||
| $inline_preview = id(new PHUIDiffInlineCommentPreviewListView()) | |||||
| ->setViewer($viewer) | |||||
| ->setInlineComments($inlines); | |||||
| $content[] = phutil_tag( | |||||
| 'div', | |||||
| array( | |||||
| 'id' => 'inline-comment-preview', | |||||
| ), | |||||
| $inline_preview); | |||||
| } | |||||
| return $content; | |||||
| } | |||||
| } | } | ||||