Skip to content

Commit 105cbaa

Browse files
author
epriestley
committedNov 3, 2015
Implement a basic version of ApplicationEditor in Paste
Summary: Ref T9132. Ref T4768. This is a rough v0 of ApplicationEditor, which replaces the edit workflow in Paste. This mostly looks and works like ApplicationSearch, and is heavily modeled on it. Roughly, we define a set of editable fields and the ApplicationEditor stuff builds everything else. This has no functional changes, except: - I removed "Fork Paste" since I don't think it's particularly useful now that pastes are editable. We could restore it if users miss it. - Subscribers are now editable. - Form field order is a little goofy (this will be fixed in a future diff). - Subscribers and projects are now race-resistant. The race-resistance works like this: instead of submitting just the new value ("subscribers=apple, dog") and doing a set operation ("set subscribers = apple, dog"), we submit the old and new values ("original=apple" + "new=apple, dog") then apply the user's changes as an add + remove ("add=dog", "remove=<none>"). This means that two users who do "Edit Paste" at around the same time and each add or remove a couple of subscribers won't overwrite each other, unless they actually add or remove the exact same subscribers (in which case their edits legitimately conflict). Previously, the last user to save would win, and whatever was in their field would overwrite the prior state, potentially losing the first user's edits. Test Plan: - Created pastes. - Created pastes via API. - Edited pastes. - Edited every field. - Opened a paste in two windows and did project/subscriber edits in each, saved in arbitrary order, had edits respected. Reviewers: chad Reviewed By: chad Maniphest Tasks: T4768, T9132 Differential Revision: https://secure.phabricator.com/D14390
1 parent 1b00ef0 commit 105cbaa

21 files changed

+978
-270
lines changed
 

‎src/__phutil_library_map__.php

+20
Original file line numberDiff line numberDiff line change
@@ -1570,6 +1570,7 @@
15701570
'PhabricatorApplicationDatasource' => 'applications/meta/typeahead/PhabricatorApplicationDatasource.php',
15711571
'PhabricatorApplicationDetailViewController' => 'applications/meta/controller/PhabricatorApplicationDetailViewController.php',
15721572
'PhabricatorApplicationEditController' => 'applications/meta/controller/PhabricatorApplicationEditController.php',
1573+
'PhabricatorApplicationEditEngine' => 'applications/transactions/editengine/PhabricatorApplicationEditEngine.php',
15731574
'PhabricatorApplicationEmailCommandsController' => 'applications/meta/controller/PhabricatorApplicationEmailCommandsController.php',
15741575
'PhabricatorApplicationLaunchView' => 'applications/meta/view/PhabricatorApplicationLaunchView.php',
15751576
'PhabricatorApplicationPanelController' => 'applications/meta/controller/PhabricatorApplicationPanelController.php',
@@ -2063,6 +2064,7 @@
20632064
'PhabricatorDataCacheSpec' => 'applications/cache/spec/PhabricatorDataCacheSpec.php',
20642065
'PhabricatorDataNotAttachedException' => 'infrastructure/storage/lisk/PhabricatorDataNotAttachedException.php',
20652066
'PhabricatorDatabaseSetupCheck' => 'applications/config/check/PhabricatorDatabaseSetupCheck.php',
2067+
'PhabricatorDatasourceEditField' => 'applications/transactions/editfield/PhabricatorDatasourceEditField.php',
20662068
'PhabricatorDateTimeSettingsPanel' => 'applications/settings/panel/PhabricatorDateTimeSettingsPanel.php',
20672069
'PhabricatorDebugController' => 'applications/system/controller/PhabricatorDebugController.php',
20682070
'PhabricatorDefaultRequestExceptionHandler' => 'aphront/handler/PhabricatorDefaultRequestExceptionHandler.php',
@@ -2097,6 +2099,7 @@
20972099
'PhabricatorEdgeTestCase' => 'infrastructure/edges/__tests__/PhabricatorEdgeTestCase.php',
20982100
'PhabricatorEdgeType' => 'infrastructure/edges/type/PhabricatorEdgeType.php',
20992101
'PhabricatorEdgeTypeTestCase' => 'infrastructure/edges/type/__tests__/PhabricatorEdgeTypeTestCase.php',
2102+
'PhabricatorEditField' => 'applications/transactions/editfield/PhabricatorEditField.php',
21002103
'PhabricatorEditor' => 'infrastructure/PhabricatorEditor.php',
21012104
'PhabricatorElasticSearchEngine' => 'applications/search/engine/PhabricatorElasticSearchEngine.php',
21022105
'PhabricatorElasticSearchSetupCheck' => 'applications/config/check/PhabricatorElasticSearchSetupCheck.php',
@@ -2554,6 +2557,7 @@
25542557
'PhabricatorPasteController' => 'applications/paste/controller/PhabricatorPasteController.php',
25552558
'PhabricatorPasteDAO' => 'applications/paste/storage/PhabricatorPasteDAO.php',
25562559
'PhabricatorPasteEditController' => 'applications/paste/controller/PhabricatorPasteEditController.php',
2560+
'PhabricatorPasteEditEngine' => 'applications/paste/editor/PhabricatorPasteEditEngine.php',
25572561
'PhabricatorPasteEditor' => 'applications/paste/editor/PhabricatorPasteEditor.php',
25582562
'PhabricatorPasteListController' => 'applications/paste/controller/PhabricatorPasteListController.php',
25592563
'PhabricatorPastePastePHIDType' => 'applications/paste/phid/PhabricatorPastePastePHIDType.php',
@@ -2654,6 +2658,7 @@
26542658
'PhabricatorPolicyDAO' => 'applications/policy/storage/PhabricatorPolicyDAO.php',
26552659
'PhabricatorPolicyDataTestCase' => 'applications/policy/__tests__/PhabricatorPolicyDataTestCase.php',
26562660
'PhabricatorPolicyEditController' => 'applications/policy/controller/PhabricatorPolicyEditController.php',
2661+
'PhabricatorPolicyEditField' => 'applications/transactions/editfield/PhabricatorPolicyEditField.php',
26572662
'PhabricatorPolicyException' => 'applications/policy/exception/PhabricatorPolicyException.php',
26582663
'PhabricatorPolicyExplainController' => 'applications/policy/controller/PhabricatorPolicyExplainController.php',
26592664
'PhabricatorPolicyFilter' => 'applications/policy/filter/PhabricatorPolicyFilter.php',
@@ -2917,6 +2922,7 @@
29172922
'PhabricatorSearchWorker' => 'applications/search/worker/PhabricatorSearchWorker.php',
29182923
'PhabricatorSecurityConfigOptions' => 'applications/config/option/PhabricatorSecurityConfigOptions.php',
29192924
'PhabricatorSecuritySetupCheck' => 'applications/config/check/PhabricatorSecuritySetupCheck.php',
2925+
'PhabricatorSelectEditField' => 'applications/transactions/editfield/PhabricatorSelectEditField.php',
29202926
'PhabricatorSendGridConfigOptions' => 'applications/config/option/PhabricatorSendGridConfigOptions.php',
29212927
'PhabricatorSessionsSettingsPanel' => 'applications/settings/panel/PhabricatorSessionsSettingsPanel.php',
29222928
'PhabricatorSettingsAddEmailAction' => 'applications/settings/action/PhabricatorSettingsAddEmailAction.php',
@@ -2957,6 +2963,7 @@
29572963
'PhabricatorSlugTestCase' => 'infrastructure/util/__tests__/PhabricatorSlugTestCase.php',
29582964
'PhabricatorSortTableUIExample' => 'applications/uiexample/examples/PhabricatorSortTableUIExample.php',
29592965
'PhabricatorSourceCodeView' => 'view/layout/PhabricatorSourceCodeView.php',
2966+
'PhabricatorSpaceEditField' => 'applications/transactions/editfield/PhabricatorSpaceEditField.php',
29602967
'PhabricatorSpacesApplication' => 'applications/spaces/application/PhabricatorSpacesApplication.php',
29612968
'PhabricatorSpacesArchiveController' => 'applications/spaces/controller/PhabricatorSpacesArchiveController.php',
29622969
'PhabricatorSpacesCapabilityCreateSpaces' => 'applications/spaces/capability/PhabricatorSpacesCapabilityCreateSpaces.php',
@@ -3063,6 +3070,8 @@
30633070
'PhabricatorTestNoCycleEdgeType' => 'applications/transactions/edges/PhabricatorTestNoCycleEdgeType.php',
30643071
'PhabricatorTestStorageEngine' => 'applications/files/engine/PhabricatorTestStorageEngine.php',
30653072
'PhabricatorTestWorker' => 'infrastructure/daemon/workers/__tests__/PhabricatorTestWorker.php',
3073+
'PhabricatorTextAreaEditField' => 'applications/transactions/editfield/PhabricatorTextAreaEditField.php',
3074+
'PhabricatorTextEditField' => 'applications/transactions/editfield/PhabricatorTextEditField.php',
30663075
'PhabricatorTime' => 'infrastructure/time/PhabricatorTime.php',
30673076
'PhabricatorTimeGuard' => 'infrastructure/time/PhabricatorTimeGuard.php',
30683077
'PhabricatorTimeTestCase' => 'infrastructure/time/__tests__/PhabricatorTimeTestCase.php',
@@ -3084,6 +3093,7 @@
30843093
'PhabricatorTokenReceiverQuery' => 'applications/tokens/query/PhabricatorTokenReceiverQuery.php',
30853094
'PhabricatorTokenTokenPHIDType' => 'applications/tokens/phid/PhabricatorTokenTokenPHIDType.php',
30863095
'PhabricatorTokenUIEventListener' => 'applications/tokens/event/PhabricatorTokenUIEventListener.php',
3096+
'PhabricatorTokenizerEditField' => 'applications/transactions/editfield/PhabricatorTokenizerEditField.php',
30873097
'PhabricatorTokensApplication' => 'applications/tokens/application/PhabricatorTokensApplication.php',
30883098
'PhabricatorTokensSettingsPanel' => 'applications/settings/panel/PhabricatorTokensSettingsPanel.php',
30893099
'PhabricatorTooltipUIExample' => 'applications/uiexample/examples/PhabricatorTooltipUIExample.php',
@@ -5489,6 +5499,7 @@
54895499
'PhabricatorApplicationDatasource' => 'PhabricatorTypeaheadDatasource',
54905500
'PhabricatorApplicationDetailViewController' => 'PhabricatorApplicationsController',
54915501
'PhabricatorApplicationEditController' => 'PhabricatorApplicationsController',
5502+
'PhabricatorApplicationEditEngine' => 'Phobject',
54925503
'PhabricatorApplicationEmailCommandsController' => 'PhabricatorApplicationsController',
54935504
'PhabricatorApplicationLaunchView' => 'AphrontTagView',
54945505
'PhabricatorApplicationPanelController' => 'PhabricatorApplicationsController',
@@ -6080,6 +6091,7 @@
60806091
'PhabricatorDataCacheSpec' => 'PhabricatorCacheSpec',
60816092
'PhabricatorDataNotAttachedException' => 'Exception',
60826093
'PhabricatorDatabaseSetupCheck' => 'PhabricatorSetupCheck',
6094+
'PhabricatorDatasourceEditField' => 'PhabricatorTokenizerEditField',
60836095
'PhabricatorDateTimeSettingsPanel' => 'PhabricatorSettingsPanel',
60846096
'PhabricatorDebugController' => 'PhabricatorController',
60856097
'PhabricatorDefaultRequestExceptionHandler' => 'PhabricatorRequestExceptionHandler',
@@ -6113,6 +6125,7 @@
61136125
'PhabricatorEdgeTestCase' => 'PhabricatorTestCase',
61146126
'PhabricatorEdgeType' => 'Phobject',
61156127
'PhabricatorEdgeTypeTestCase' => 'PhabricatorTestCase',
6128+
'PhabricatorEditField' => 'Phobject',
61166129
'PhabricatorEditor' => 'Phobject',
61176130
'PhabricatorElasticSearchEngine' => 'PhabricatorSearchEngine',
61186131
'PhabricatorElasticSearchSetupCheck' => 'PhabricatorSetupCheck',
@@ -6647,6 +6660,7 @@
66476660
'PhabricatorPasteController' => 'PhabricatorController',
66486661
'PhabricatorPasteDAO' => 'PhabricatorLiskDAO',
66496662
'PhabricatorPasteEditController' => 'PhabricatorPasteController',
6663+
'PhabricatorPasteEditEngine' => 'PhabricatorApplicationEditEngine',
66506664
'PhabricatorPasteEditor' => 'PhabricatorApplicationTransactionEditor',
66516665
'PhabricatorPasteListController' => 'PhabricatorPasteController',
66526666
'PhabricatorPastePastePHIDType' => 'PhabricatorPHIDType',
@@ -6762,6 +6776,7 @@
67626776
'PhabricatorPolicyDAO' => 'PhabricatorLiskDAO',
67636777
'PhabricatorPolicyDataTestCase' => 'PhabricatorTestCase',
67646778
'PhabricatorPolicyEditController' => 'PhabricatorPolicyController',
6779+
'PhabricatorPolicyEditField' => 'PhabricatorEditField',
67656780
'PhabricatorPolicyException' => 'Exception',
67666781
'PhabricatorPolicyExplainController' => 'PhabricatorPolicyController',
67676782
'PhabricatorPolicyFilter' => 'Phobject',
@@ -7090,6 +7105,7 @@
70907105
'PhabricatorSearchWorker' => 'PhabricatorWorker',
70917106
'PhabricatorSecurityConfigOptions' => 'PhabricatorApplicationConfigOptions',
70927107
'PhabricatorSecuritySetupCheck' => 'PhabricatorSetupCheck',
7108+
'PhabricatorSelectEditField' => 'PhabricatorEditField',
70937109
'PhabricatorSendGridConfigOptions' => 'PhabricatorApplicationConfigOptions',
70947110
'PhabricatorSessionsSettingsPanel' => 'PhabricatorSettingsPanel',
70957111
'PhabricatorSettingsAddEmailAction' => 'PhabricatorSystemAction',
@@ -7140,6 +7156,7 @@
71407156
'PhabricatorSlugTestCase' => 'PhabricatorTestCase',
71417157
'PhabricatorSortTableUIExample' => 'PhabricatorUIExample',
71427158
'PhabricatorSourceCodeView' => 'AphrontView',
7159+
'PhabricatorSpaceEditField' => 'PhabricatorEditField',
71437160
'PhabricatorSpacesApplication' => 'PhabricatorApplication',
71447161
'PhabricatorSpacesArchiveController' => 'PhabricatorSpacesController',
71457162
'PhabricatorSpacesCapabilityCreateSpaces' => 'PhabricatorPolicyCapability',
@@ -7252,6 +7269,8 @@
72527269
'PhabricatorTestNoCycleEdgeType' => 'PhabricatorEdgeType',
72537270
'PhabricatorTestStorageEngine' => 'PhabricatorFileStorageEngine',
72547271
'PhabricatorTestWorker' => 'PhabricatorWorker',
7272+
'PhabricatorTextAreaEditField' => 'PhabricatorEditField',
7273+
'PhabricatorTextEditField' => 'PhabricatorEditField',
72557274
'PhabricatorTime' => 'Phobject',
72567275
'PhabricatorTimeGuard' => 'Phobject',
72577276
'PhabricatorTimeTestCase' => 'PhabricatorTestCase',
@@ -7278,6 +7297,7 @@
72787297
'PhabricatorTokenReceiverQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
72797298
'PhabricatorTokenTokenPHIDType' => 'PhabricatorPHIDType',
72807299
'PhabricatorTokenUIEventListener' => 'PhabricatorEventListener',
7300+
'PhabricatorTokenizerEditField' => 'PhabricatorEditField',
72817301
'PhabricatorTokensApplication' => 'PhabricatorApplication',
72827302
'PhabricatorTokensSettingsPanel' => 'PhabricatorSettingsPanel',
72837303
'PhabricatorTooltipUIExample' => 'PhabricatorUIExample',

‎src/applications/base/controller/PhabricatorController.php

+8
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,14 @@ protected function buildTransactionTimeline(
521521
}
522522

523523

524+
public function buildApplicationCrumbsForEditEngine() {
525+
// TODO: This is kind of gross, I'm bascially just making this public so
526+
// I can use it in EditEngine. We could do this without making it public
527+
// by using controller delegation, or make it properly public.
528+
return $this->buildApplicationCrumbs();
529+
}
530+
531+
524532
/* -( Deprecated )--------------------------------------------------------- */
525533

526534

‎src/applications/paste/conduit/PasteCreateConduitAPIMethod.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,11 @@ protected function execute(ConduitAPIRequest $request) {
4444

4545
$paste = PhabricatorPaste::initializeNewPaste($viewer);
4646

47-
$file = PhabricatorPasteEditor::initializeFileForPaste(
48-
$viewer,
49-
$title,
50-
$content);
51-
5247
$xactions = array();
5348

5449
$xactions[] = id(new PhabricatorPasteTransaction())
5550
->setTransactionType(PhabricatorPasteTransaction::TYPE_CONTENT)
56-
->setNewValue($file->getPHID());
51+
->setNewValue($content);
5752

5853
$xactions[] = id(new PhabricatorPasteTransaction())
5954
->setTransactionType(PhabricatorPasteTransaction::TYPE_TITLE)

0 commit comments

Comments
 (0)
Failed to load comments.