Skip to content

Commit 18249b0

Browse files
author
epriestley
committed
Make inline comment preview and submission mostly work on EditEngine
Summary: Ref T11114. This comments nearly working on EditEngine. Only significant issue I caught is that the "View" link doesn't render properly because it depends on JS which is tricky to hook up. I'll clean that up in a future diff. Test Plan: {F2279201} Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17116
1 parent f7b5955 commit 18249b0

13 files changed

+195
-215
lines changed

resources/celerity/map.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
'core.pkg.js' => '28e8cda8',
1414
'darkconsole.pkg.js' => 'e7393ebb',
1515
'differential.pkg.css' => 'a4ba74b5',
16-
'differential.pkg.js' => '634399e9',
16+
'differential.pkg.js' => '40b18f35',
1717
'diffusion.pkg.css' => '91c5d3a6',
1818
'diffusion.pkg.js' => '84c8f8fd',
1919
'favicon.ico' => '30672e08',
@@ -397,7 +397,7 @@
397397
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375',
398398
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63',
399399
'rsrc/js/application/differential/ChangesetViewManager.js' => 'a2828756',
400-
'rsrc/js/application/differential/DifferentialInlineCommentEditor.js' => '64a5550f',
400+
'rsrc/js/application/differential/DifferentialInlineCommentEditor.js' => '2e3f9738',
401401
'rsrc/js/application/differential/behavior-add-reviewers-and-ccs.js' => 'e10f8e18',
402402
'rsrc/js/application/differential/behavior-comment-jump.js' => '4fdb476d',
403403
'rsrc/js/application/differential/behavior-comment-preview.js' => 'b064af76',
@@ -453,7 +453,7 @@
453453
'rsrc/js/application/search/behavior-reorder-profile-menu-items.js' => 'e2e0a072',
454454
'rsrc/js/application/search/behavior-reorder-queries.js' => 'e9581f08',
455455
'rsrc/js/application/slowvote/behavior-slowvote-embed.js' => '887ad43f',
456-
'rsrc/js/application/transactions/behavior-comment-actions.js' => '1be09f3f',
456+
'rsrc/js/application/transactions/behavior-comment-actions.js' => 'c23ecb0b',
457457
'rsrc/js/application/transactions/behavior-reorder-configs.js' => 'd7a74243',
458458
'rsrc/js/application/transactions/behavior-reorder-fields.js' => 'b59e1e96',
459459
'rsrc/js/application/transactions/behavior-show-older-transactions.js' => '94c65b72',
@@ -575,7 +575,7 @@
575575
'd3' => 'a11a5ff2',
576576
'differential-changeset-view-css' => 'b158cc46',
577577
'differential-core-view-css' => '5b7b8ff4',
578-
'differential-inline-comment-editor' => '64a5550f',
578+
'differential-inline-comment-editor' => '2e3f9738',
579579
'differential-revision-add-comment-css' => 'c47f8c40',
580580
'differential-revision-comment-css' => '14b8565a',
581581
'differential-revision-history-css' => '0e8eb855',
@@ -609,7 +609,7 @@
609609
'javelin-behavior-bulk-job-reload' => 'edf8a145',
610610
'javelin-behavior-calendar-month-view' => 'fe33e256',
611611
'javelin-behavior-choose-control' => '327a00d1',
612-
'javelin-behavior-comment-actions' => '1be09f3f',
612+
'javelin-behavior-comment-actions' => 'c23ecb0b',
613613
'javelin-behavior-config-reorder-fields' => 'b6993408',
614614
'javelin-behavior-conpherence-menu' => '7524fcfa',
615615
'javelin-behavior-conpherence-participant-pane' => '8604caa8',
@@ -1083,15 +1083,6 @@
10831083
'javelin-request',
10841084
'javelin-uri',
10851085
),
1086-
'1be09f3f' => array(
1087-
'javelin-behavior',
1088-
'javelin-stratcom',
1089-
'javelin-workflow',
1090-
'javelin-dom',
1091-
'phuix-form-control-view',
1092-
'phuix-icon-view',
1093-
'javelin-behavior-phabricator-gesture',
1094-
),
10951086
'1def2711' => array(
10961087
'javelin-install',
10971088
'javelin-dom',
@@ -1156,6 +1147,14 @@
11561147
'javelin-install',
11571148
'javelin-event',
11581149
),
1150+
'2e3f9738' => array(
1151+
'javelin-dom',
1152+
'javelin-util',
1153+
'javelin-stratcom',
1154+
'javelin-install',
1155+
'javelin-request',
1156+
'javelin-workflow',
1157+
),
11591158
'2ee659ce' => array(
11601159
'javelin-install',
11611160
),
@@ -1421,14 +1420,6 @@
14211420
'javelin-workflow',
14221421
'javelin-dom',
14231422
),
1424-
'64a5550f' => array(
1425-
'javelin-dom',
1426-
'javelin-util',
1427-
'javelin-stratcom',
1428-
'javelin-install',
1429-
'javelin-request',
1430-
'javelin-workflow',
1431-
),
14321423
'680ea2c8' => array(
14331424
'javelin-install',
14341425
'javelin-dom',
@@ -1956,6 +1947,15 @@
19561947
'javelin-install',
19571948
'javelin-dom',
19581949
),
1950+
'c23ecb0b' => array(
1951+
'javelin-behavior',
1952+
'javelin-stratcom',
1953+
'javelin-workflow',
1954+
'javelin-dom',
1955+
'phuix-form-control-view',
1956+
'phuix-icon-view',
1957+
'javelin-behavior-phabricator-gesture',
1958+
),
19591959
'c587b80f' => array(
19601960
'javelin-install',
19611961
),

src/__phutil_library_map__.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,6 @@
379379
'DifferentialChangesetTwoUpTestRenderer' => 'applications/differential/render/DifferentialChangesetTwoUpTestRenderer.php',
380380
'DifferentialChangesetViewController' => 'applications/differential/controller/DifferentialChangesetViewController.php',
381381
'DifferentialCloseConduitAPIMethod' => 'applications/differential/conduit/DifferentialCloseConduitAPIMethod.php',
382-
'DifferentialCommentPreviewController' => 'applications/differential/controller/DifferentialCommentPreviewController.php',
383382
'DifferentialCommitMessageCustomField' => 'applications/differential/field/DifferentialCommitMessageCustomField.php',
384383
'DifferentialCommitMessageField' => 'applications/differential/field/DifferentialCommitMessageField.php',
385384
'DifferentialCommitMessageParser' => 'applications/differential/parser/DifferentialCommitMessageParser.php',
@@ -457,7 +456,6 @@
457456
'DifferentialInlineComment' => 'applications/differential/storage/DifferentialInlineComment.php',
458457
'DifferentialInlineCommentEditController' => 'applications/differential/controller/DifferentialInlineCommentEditController.php',
459458
'DifferentialInlineCommentMailView' => 'applications/differential/mail/DifferentialInlineCommentMailView.php',
460-
'DifferentialInlineCommentPreviewController' => 'applications/differential/controller/DifferentialInlineCommentPreviewController.php',
461459
'DifferentialInlineCommentQuery' => 'applications/differential/query/DifferentialInlineCommentQuery.php',
462460
'DifferentialJIRAIssuesCommitMessageField' => 'applications/differential/field/DifferentialJIRAIssuesCommitMessageField.php',
463461
'DifferentialJIRAIssuesField' => 'applications/differential/customfield/DifferentialJIRAIssuesField.php',
@@ -1641,6 +1639,7 @@
16411639
'PHUIDiffGraphViewTestCase' => 'infrastructure/diff/view/__tests__/PHUIDiffGraphViewTestCase.php',
16421640
'PHUIDiffInlineCommentDetailView' => 'infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php',
16431641
'PHUIDiffInlineCommentEditView' => 'infrastructure/diff/view/PHUIDiffInlineCommentEditView.php',
1642+
'PHUIDiffInlineCommentPreviewListView' => 'infrastructure/diff/view/PHUIDiffInlineCommentPreviewListView.php',
16441643
'PHUIDiffInlineCommentRowScaffold' => 'infrastructure/diff/view/PHUIDiffInlineCommentRowScaffold.php',
16451644
'PHUIDiffInlineCommentTableScaffold' => 'infrastructure/diff/view/PHUIDiffInlineCommentTableScaffold.php',
16461645
'PHUIDiffInlineCommentUndoView' => 'infrastructure/diff/view/PHUIDiffInlineCommentUndoView.php',
@@ -5029,7 +5028,6 @@
50295028
'DifferentialChangesetTwoUpTestRenderer' => 'DifferentialChangesetTestRenderer',
50305029
'DifferentialChangesetViewController' => 'DifferentialController',
50315030
'DifferentialCloseConduitAPIMethod' => 'DifferentialConduitAPIMethod',
5032-
'DifferentialCommentPreviewController' => 'DifferentialController',
50335031
'DifferentialCommitMessageCustomField' => 'DifferentialCommitMessageField',
50345032
'DifferentialCommitMessageField' => 'Phobject',
50355033
'DifferentialCommitMessageParser' => 'Phobject',
@@ -5120,7 +5118,6 @@
51205118
),
51215119
'DifferentialInlineCommentEditController' => 'PhabricatorInlineCommentController',
51225120
'DifferentialInlineCommentMailView' => 'DifferentialMailView',
5123-
'DifferentialInlineCommentPreviewController' => 'PhabricatorInlineCommentPreviewController',
51245121
'DifferentialInlineCommentQuery' => 'PhabricatorOffsetPagedQuery',
51255122
'DifferentialJIRAIssuesCommitMessageField' => 'DifferentialCommitMessageCustomField',
51265123
'DifferentialJIRAIssuesField' => 'DifferentialStoredCustomField',
@@ -6484,6 +6481,7 @@
64846481
'PHUIDiffGraphViewTestCase' => 'PhabricatorTestCase',
64856482
'PHUIDiffInlineCommentDetailView' => 'PHUIDiffInlineCommentView',
64866483
'PHUIDiffInlineCommentEditView' => 'PHUIDiffInlineCommentView',
6484+
'PHUIDiffInlineCommentPreviewListView' => 'AphrontView',
64876485
'PHUIDiffInlineCommentRowScaffold' => 'AphrontView',
64886486
'PHUIDiffInlineCommentTableScaffold' => 'AphrontView',
64896487
'PHUIDiffInlineCommentUndoView' => 'PHUIDiffInlineCommentView',

src/applications/differential/controller/DifferentialCommentPreviewController.php

Lines changed: 0 additions & 139 deletions
This file was deleted.

src/applications/differential/controller/DifferentialInlineCommentPreviewController.php

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/applications/differential/editor/DifferentialRevisionEditEngine.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,4 +247,52 @@ private function isCustomFieldEnabled(DifferentialRevision $revision, $key) {
247247
return isset($fields[$key]);
248248
}
249249

250+
protected function newAutomaticCommentTransactions($object) {
251+
$viewer = $this->getViewer();
252+
$xactions = array();
253+
254+
$inlines = DifferentialTransactionQuery::loadUnsubmittedInlineComments(
255+
$viewer,
256+
$object);
257+
$inlines = msort($inlines, 'getID');
258+
259+
foreach ($inlines as $inline) {
260+
$xactions[] = id(new DifferentialTransaction())
261+
->setTransactionType(DifferentialTransaction::TYPE_INLINE)
262+
->attachComment($inline);
263+
}
264+
265+
return $xactions;
266+
}
267+
268+
protected function newCommentPreviewContent($object, array $xactions) {
269+
$viewer = $this->getViewer();
270+
$type_inline = DifferentialTransaction::TYPE_INLINE;
271+
272+
$inlines = array();
273+
foreach ($xactions as $xaction) {
274+
if ($xaction->getTransactionType() === $type_inline) {
275+
$inlines[] = $xaction->getComment();
276+
}
277+
}
278+
279+
$content = array();
280+
281+
if ($inlines) {
282+
$inline_preview = id(new PHUIDiffInlineCommentPreviewListView())
283+
->setViewer($viewer)
284+
->setInlineComments($inlines);
285+
286+
$content[] = phutil_tag(
287+
'div',
288+
array(
289+
'id' => 'inline-comment-preview',
290+
),
291+
$inline_preview);
292+
}
293+
294+
return $content;
295+
}
296+
297+
250298
}

0 commit comments

Comments
 (0)