@@ -41,6 +41,8 @@ public function processRequest() {
41
41
"This revision has no diffs. Something has gone quite wrong. " );
42
42
}
43
43
44
+ $ revision ->attachActiveDiff (last ($ diffs ));
45
+
44
46
$ diff_vs = $ request ->getInt ('vs ' );
45
47
46
48
$ target_id = $ request ->getInt ('id ' );
@@ -82,8 +84,6 @@ public function processRequest() {
82
84
$ target_manual ->getID ());
83
85
$ props = mpull ($ props , 'getData ' , 'getName ' );
84
86
85
- $ aux_fields = $ this ->loadAuxiliaryFields ($ revision );
86
-
87
87
$ comments = $ revision ->loadComments ();
88
88
89
89
$ all_changesets = $ changesets ;
@@ -113,25 +113,8 @@ public function processRequest() {
113
113
}
114
114
}
115
115
116
- $ aux_phids = array ();
117
- foreach ($ aux_fields as $ key => $ aux_field ) {
118
- $ aux_field ->setDiff ($ target );
119
- $ aux_field ->setManualDiff ($ target_manual );
120
- $ aux_field ->setDiffProperties ($ props );
121
- $ aux_phids [$ key ] = $ aux_field ->getRequiredHandlePHIDsForRevisionView ();
122
- }
123
- $ object_phids = array_merge ($ object_phids , array_mergev ($ aux_phids ));
124
- $ object_phids = array_unique ($ object_phids );
125
-
126
116
$ handles = $ this ->loadViewerHandles ($ object_phids );
127
117
128
- foreach ($ aux_fields as $ key => $ aux_field ) {
129
- // Make sure each field only has access to handles it specifically
130
- // requested, not all handles. Otherwise you can get a field which works
131
- // only in the presence of other fields.
132
- $ aux_field ->setHandles (array_select_keys ($ handles , $ aux_phids [$ key ]));
133
- }
134
-
135
118
$ request_uri = $ request ->getRequestURI ();
136
119
137
120
$ limit = 100 ;
@@ -184,32 +167,22 @@ public function processRequest() {
184
167
$ visible_changesets = $ changesets ;
185
168
}
186
169
170
+ $ field_list = PhabricatorCustomField::getObjectFields (
171
+ $ revision ,
172
+ PhabricatorCustomField::ROLE_VIEW );
173
+
174
+ $ field_list ->setViewer ($ user );
175
+ $ field_list ->readFieldsFromStorage ($ revision );
176
+
187
177
$ revision_detail = id (new DifferentialRevisionDetailView ())
188
178
->setUser ($ user )
189
179
->setRevision ($ revision )
190
180
->setDiff (end ($ diffs ))
191
- ->setAuxiliaryFields ( $ aux_fields )
181
+ ->setCustomFields ( $ field_list )
192
182
->setURI ($ request ->getRequestURI ());
193
183
194
184
$ actions = $ this ->getRevisionActions ($ revision );
195
185
196
- $ custom_renderer_class = PhabricatorEnv::getEnvConfig (
197
- 'differential.revision-custom-detail-renderer ' );
198
- if ($ custom_renderer_class ) {
199
-
200
- // TODO: build a better version of the action links and deprecate the
201
- // whole DifferentialRevisionDetailRenderer class.
202
- $ custom_renderer = newv ($ custom_renderer_class , array ());
203
- $ custom_renderer ->setUser ($ user );
204
- $ custom_renderer ->setDiff ($ target );
205
- if ($ diff_vs ) {
206
- $ custom_renderer ->setVSDiff ($ diffs [$ diff_vs ]);
207
- }
208
- $ actions = array_merge (
209
- $ actions ,
210
- $ custom_renderer ->generateActionLinks ($ revision , $ target_manual ));
211
- }
212
-
213
186
$ whitespace = $ request ->getStr (
214
187
'whitespace ' ,
215
188
DifferentialChangesetParser::WHITESPACE_IGNORE_ALL );
@@ -340,7 +313,9 @@ public function processRequest() {
340
313
341
314
$ comment_form = new DifferentialAddCommentView ();
342
315
$ comment_form ->setRevision ($ revision );
343
- $ comment_form ->setAuxFields ($ aux_fields );
316
+
317
+ // TODO: Restore the ability for fields to add accept warnings.
318
+
344
319
$ comment_form ->setActions ($ this ->getRevisionCommentActions ($ revision ));
345
320
346
321
$ action_uri = '/differential/comment/save/ ' ;
@@ -450,46 +425,42 @@ private function getRevisionActions(DifferentialRevision $revision) {
450
425
$ revision ,
451
426
PhabricatorPolicyCapability::CAN_EDIT );
452
427
453
- $ links = array ();
428
+ $ actions = array ();
454
429
455
- $ links [] = array (
456
- 'icon ' => 'edit ' ,
457
- 'href ' => "/differential/revision/edit/ {$ revision_id }/ " ,
458
- 'name ' => pht ('Edit Revision ' ),
459
- 'disabled ' => !$ can_edit ,
460
- 'sigil ' => $ can_edit ? null : 'workflow ' ,
461
- );
430
+ $ actions [] = id (new PhabricatorActionView ())
431
+ ->setIcon ('edit ' )
432
+ ->setHref ("/differential/revision/edit/ {$ revision_id }/ " )
433
+ ->setName (pht ('Edit Revision ' ))
434
+ ->setDisabled (!$ can_edit )
435
+ ->setWorkflow (!$ can_edit );
462
436
463
437
$ this ->requireResource ('phabricator-object-selector-css ' );
464
438
$ this ->requireResource ('javelin-behavior-phabricator-object-selector ' );
465
439
466
- $ links [] = array (
467
- 'icon ' => 'link ' ,
468
- 'name ' => pht ('Edit Dependencies ' ),
469
- 'href ' => "/search/attach/ {$ revision_phid }/DREV/dependencies/ " ,
470
- 'sigil ' => 'workflow ' ,
471
- 'disabled ' => !$ can_edit ,
472
- );
440
+ $ actions [] = id (new PhabricatorActionView ())
441
+ ->setIcon ('link ' )
442
+ ->setName (pht ('Edit Dependencies ' ))
443
+ ->setHref ("/search/attach/ {$ revision_phid }/DREV/dependencies/ " )
444
+ ->setWorkflow (true )
445
+ ->setDisabled (!$ can_edit );
473
446
474
447
$ maniphest = 'PhabricatorApplicationManiphest ' ;
475
448
if (PhabricatorApplication::isClassInstalled ($ maniphest )) {
476
- $ links [] = array (
477
- 'icon ' => 'attach ' ,
478
- 'name ' => pht ('Edit Maniphest Tasks ' ),
479
- 'href ' => "/search/attach/ {$ revision_phid }/TASK/ " ,
480
- 'sigil ' => 'workflow ' ,
481
- 'disabled ' => !$ can_edit ,
482
- );
449
+ $ actions [] = id (new PhabricatorActionView ())
450
+ ->setIcon ('attach ' )
451
+ ->setName (pht ('Edit Maniphest Tasks ' ))
452
+ ->setHref ("/search/attach/ {$ revision_phid }/TASK/ " )
453
+ ->setWorkflow (true )
454
+ ->setDisabled (!$ can_edit );
483
455
}
484
456
485
457
$ request_uri = $ this ->getRequest ()->getRequestURI ();
486
- $ links [] = array (
487
- 'icon ' => 'download ' ,
488
- 'name ' => pht ('Download Raw Diff ' ),
489
- 'href ' => $ request_uri ->alter ('download ' , 'true ' )
490
- );
458
+ $ actions [] = id (new PhabricatorActionView ())
459
+ ->setIcon ('download ' )
460
+ ->setName (pht ('Download Raw Diff ' ))
461
+ ->setHref ($ request_uri ->alter ('download ' , 'true ' ));
491
462
492
- return $ links ;
463
+ return $ actions ;
493
464
}
494
465
495
466
private function getRevisionCommentActions (DifferentialRevision $ revision ) {
@@ -689,25 +660,6 @@ private function loadChangesetsAndVsMap(
689
660
return array ($ changesets , $ vs_map , $ vs_changesets , $ refs );
690
661
}
691
662
692
- private function loadAuxiliaryFields (DifferentialRevision $ revision ) {
693
-
694
- $ aux_fields = DifferentialFieldSelector::newSelector ()
695
- ->getFieldSpecifications ();
696
- foreach ($ aux_fields as $ key => $ aux_field ) {
697
- if (!$ aux_field ->shouldAppearOnRevisionView ()) {
698
- unset($ aux_fields [$ key ]);
699
- } else {
700
- $ aux_field ->setUser ($ this ->getRequest ()->getUser ());
701
- }
702
- }
703
-
704
- $ aux_fields = DifferentialAuxiliaryField::loadFromStorage (
705
- $ revision ,
706
- $ aux_fields );
707
-
708
- return $ aux_fields ;
709
- }
710
-
711
663
private function buildSymbolIndexes (
712
664
PhabricatorRepositoryArcanistProject $ arc_project ,
713
665
array $ visible_changesets ) {
0 commit comments