1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 14:00:56 +01:00

Move users to modular transactions

Summary:
Ref T13164. See PHI642. I'd like to provide a third-generation `user.edit` API endpoint and make `user.enable` and `user.disable` obsolete before meddling with policy details, even if it isn't full-fledged yet.

Users do already have a transactions table and a Transaction-based editor, but it's only used for editing title, real name, etc. All of these are custom fields, so their support comes in automatically through CustomField extension code.

Realign it for modular transactions so new code will be fully modern. There are no actual standalone transaction types yet so this diff is pretty thin.

Test Plan:
  - Grepped for `UserProfileEditor`.
  - Edited a user's title/real name/icon.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13164

Differential Revision: https://secure.phabricator.com/D19576
This commit is contained in:
epriestley 2018-08-13 14:05:47 -07:00
parent ba25586016
commit 39d415e90e
6 changed files with 19 additions and 11 deletions

View file

@ -4583,7 +4583,6 @@ phutil_register_library_map(array(
'PhabricatorUserPreferencesTransaction' => 'applications/settings/storage/PhabricatorUserPreferencesTransaction.php',
'PhabricatorUserPreferencesTransactionQuery' => 'applications/settings/query/PhabricatorUserPreferencesTransactionQuery.php',
'PhabricatorUserProfile' => 'applications/people/storage/PhabricatorUserProfile.php',
'PhabricatorUserProfileEditor' => 'applications/people/editor/PhabricatorUserProfileEditor.php',
'PhabricatorUserProfileImageCacheType' => 'applications/people/cache/PhabricatorUserProfileImageCacheType.php',
'PhabricatorUserRealNameField' => 'applications/people/customfield/PhabricatorUserRealNameField.php',
'PhabricatorUserRolesField' => 'applications/people/customfield/PhabricatorUserRolesField.php',
@ -4593,6 +4592,8 @@ phutil_register_library_map(array(
'PhabricatorUserTestCase' => 'applications/people/storage/__tests__/PhabricatorUserTestCase.php',
'PhabricatorUserTitleField' => 'applications/people/customfield/PhabricatorUserTitleField.php',
'PhabricatorUserTransaction' => 'applications/people/storage/PhabricatorUserTransaction.php',
'PhabricatorUserTransactionEditor' => 'applications/people/editor/PhabricatorUserTransactionEditor.php',
'PhabricatorUserTransactionType' => 'applications/people/xaction/PhabricatorUserTransactionType.php',
'PhabricatorUsersEditField' => 'applications/transactions/editfield/PhabricatorUsersEditField.php',
'PhabricatorUsersPolicyRule' => 'applications/people/policyrule/PhabricatorUsersPolicyRule.php',
'PhabricatorUsersSearchField' => 'applications/people/searchfield/PhabricatorUsersSearchField.php',
@ -10575,7 +10576,6 @@ phutil_register_library_map(array(
'PhabricatorUserPreferencesTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorUserPreferencesTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhabricatorUserProfile' => 'PhabricatorUserDAO',
'PhabricatorUserProfileEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorUserProfileImageCacheType' => 'PhabricatorUserCacheType',
'PhabricatorUserRealNameField' => 'PhabricatorUserCustomField',
'PhabricatorUserRolesField' => 'PhabricatorUserCustomField',
@ -10584,7 +10584,9 @@ phutil_register_library_map(array(
'PhabricatorUserStatusField' => 'PhabricatorUserCustomField',
'PhabricatorUserTestCase' => 'PhabricatorTestCase',
'PhabricatorUserTitleField' => 'PhabricatorUserCustomField',
'PhabricatorUserTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorUserTransaction' => 'PhabricatorModularTransaction',
'PhabricatorUserTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorUserTransactionType' => 'PhabricatorModularTransactionType',
'PhabricatorUsersEditField' => 'PhabricatorTokenizerEditField',
'PhabricatorUsersPolicyRule' => 'PhabricatorPolicyRule',
'PhabricatorUsersSearchField' => 'PhabricatorSearchTokenizerField',

View file

@ -38,10 +38,9 @@ final class PhabricatorPeopleProfileEditController
new PhabricatorUserTransaction(),
$request);
$editor = id(new PhabricatorUserProfileEditor())
$editor = id(new PhabricatorUserTransactionEditor())
->setActor($viewer)
->setContentSource(
PhabricatorContentSource::newFromRequest($request))
->setContentSourceFromRequest($request)
->setContinueOnNoEffect(true);
try {

View file

@ -1,6 +1,6 @@
<?php
final class PhabricatorUserProfileEditor
final class PhabricatorUserTransactionEditor
extends PhabricatorApplicationTransactionEditor {
public function getEditorApplicationClass() {
@ -8,8 +8,7 @@ final class PhabricatorUserProfileEditor
}
public function getEditorObjectsDescription() {
return pht('User Profiles');
return pht('Users');
}
}

View file

@ -1362,7 +1362,7 @@ final class PhabricatorUser
public function getApplicationTransactionEditor() {
return new PhabricatorUserProfileEditor();
return new PhabricatorUserTransactionEditor();
}
public function getApplicationTransactionObject() {

View file

@ -1,7 +1,7 @@
<?php
final class PhabricatorUserTransaction
extends PhabricatorApplicationTransaction {
extends PhabricatorModularTransaction {
public function getApplicationName() {
return 'user';
@ -15,4 +15,8 @@ final class PhabricatorUserTransaction
return null;
}
public function getBaseTransactionClass() {
return 'PhabricatorUserTransactionType';
}
}

View file

@ -0,0 +1,4 @@
<?php
abstract class PhabricatorUserTransactionType
extends PhabricatorModularTransactionType {}