1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Modularize user activity log message types

Summary:
Depends on D20670. Ref T13343. The user activity message log types are currently hard-coded, so only upstream code can really use the log construct.

Under the theory that we're going to keep this log around going forward (just focus it a little bit), modularize things so the log is extensible.

Test Plan:
Grepped for `UserLog::`, viewed activity logs in People and Settings.

(If I missed something here -- say, misspelled a constant -- the effect should just be that older logs don't get a human-readable label, so stakes are very low.)

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13343

Differential Revision: https://secure.phabricator.com/D20671
This commit is contained in:
epriestley 2019-07-19 13:55:19 -07:00
parent 6831ed94fa
commit 32dd13d434
30 changed files with 332 additions and 80 deletions

View file

@ -2117,6 +2117,8 @@ phutil_register_library_map(array(
'PhabricatorActionListView' => 'view/layout/PhabricatorActionListView.php',
'PhabricatorActionView' => 'view/layout/PhabricatorActionView.php',
'PhabricatorActivitySettingsPanel' => 'applications/settings/panel/PhabricatorActivitySettingsPanel.php',
'PhabricatorAddEmailUserLogType' => 'applications/people/userlog/PhabricatorAddEmailUserLogType.php',
'PhabricatorAddMultifactorUserLogType' => 'applications/people/userlog/PhabricatorAddMultifactorUserLogType.php',
'PhabricatorAdministratorsPolicyRule' => 'applications/people/policyrule/PhabricatorAdministratorsPolicyRule.php',
'PhabricatorAjaxRequestExceptionHandler' => 'aphront/handler/PhabricatorAjaxRequestExceptionHandler.php',
'PhabricatorAlmanacApplication' => 'applications/almanac/application/PhabricatorAlmanacApplication.php',
@ -2668,6 +2670,7 @@ phutil_register_library_map(array(
'PhabricatorCelerityApplication' => 'applications/celerity/application/PhabricatorCelerityApplication.php',
'PhabricatorCelerityTestCase' => '__tests__/PhabricatorCelerityTestCase.php',
'PhabricatorChangeParserTestCase' => 'applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php',
'PhabricatorChangePasswordUserLogType' => 'applications/people/userlog/PhabricatorChangePasswordUserLogType.php',
'PhabricatorChangesetCachePurger' => 'applications/cache/purger/PhabricatorChangesetCachePurger.php',
'PhabricatorChangesetResponse' => 'infrastructure/diff/PhabricatorChangesetResponse.php',
'PhabricatorChartAxis' => 'applications/fact/chart/PhabricatorChartAxis.php',
@ -2721,7 +2724,9 @@ phutil_register_library_map(array(
'PhabricatorConduitAPIController' => 'applications/conduit/controller/PhabricatorConduitAPIController.php',
'PhabricatorConduitApplication' => 'applications/conduit/application/PhabricatorConduitApplication.php',
'PhabricatorConduitCallManagementWorkflow' => 'applications/conduit/management/PhabricatorConduitCallManagementWorkflow.php',
'PhabricatorConduitCertificateFailureUserLogType' => 'applications/people/userlog/PhabricatorConduitCertificateFailureUserLogType.php',
'PhabricatorConduitCertificateToken' => 'applications/conduit/storage/PhabricatorConduitCertificateToken.php',
'PhabricatorConduitCertificateUserLogType' => 'applications/people/userlog/PhabricatorConduitCertificateUserLogType.php',
'PhabricatorConduitConsoleController' => 'applications/conduit/controller/PhabricatorConduitConsoleController.php',
'PhabricatorConduitContentSource' => 'infrastructure/contentsource/PhabricatorConduitContentSource.php',
'PhabricatorConduitController' => 'applications/conduit/controller/PhabricatorConduitController.php',
@ -3224,6 +3229,7 @@ phutil_register_library_map(array(
'PhabricatorEmojiRemarkupRule' => 'applications/macro/markup/PhabricatorEmojiRemarkupRule.php',
'PhabricatorEmojiTranslation' => 'infrastructure/internationalization/translation/PhabricatorEmojiTranslation.php',
'PhabricatorEmptyQueryException' => 'infrastructure/query/exception/PhabricatorEmptyQueryException.php',
'PhabricatorEnterHisecUserLogType' => 'applications/people/userlog/PhabricatorEnterHisecUserLogType.php',
'PhabricatorEnumConfigType' => 'applications/config/type/PhabricatorEnumConfigType.php',
'PhabricatorEnv' => 'infrastructure/env/PhabricatorEnv.php',
'PhabricatorEnvTestCase' => 'infrastructure/env/__tests__/PhabricatorEnvTestCase.php',
@ -3236,6 +3242,7 @@ phutil_register_library_map(array(
'PhabricatorExampleEventListener' => 'infrastructure/events/PhabricatorExampleEventListener.php',
'PhabricatorExcelExportFormat' => 'infrastructure/export/format/PhabricatorExcelExportFormat.php',
'PhabricatorExecFutureFileUploadSource' => 'applications/files/uploadsource/PhabricatorExecFutureFileUploadSource.php',
'PhabricatorExitHisecUserLogType' => 'applications/people/userlog/PhabricatorExitHisecUserLogType.php',
'PhabricatorExportEngine' => 'infrastructure/export/engine/PhabricatorExportEngine.php',
'PhabricatorExportEngineBulkJobType' => 'infrastructure/export/engine/PhabricatorExportEngineBulkJobType.php',
'PhabricatorExportEngineExtension' => 'infrastructure/export/engine/PhabricatorExportEngineExtension.php',
@ -3276,6 +3283,7 @@ phutil_register_library_map(array(
'PhabricatorFactObjectDimension' => 'applications/fact/storage/PhabricatorFactObjectDimension.php',
'PhabricatorFactRaw' => 'applications/fact/storage/PhabricatorFactRaw.php',
'PhabricatorFactUpdateIterator' => 'applications/fact/extract/PhabricatorFactUpdateIterator.php',
'PhabricatorFailHisecUserLogType' => 'applications/people/userlog/PhabricatorFailHisecUserLogType.php',
'PhabricatorFaviconRef' => 'applications/files/favicon/PhabricatorFaviconRef.php',
'PhabricatorFaviconRefQuery' => 'applications/files/favicon/PhabricatorFaviconRefQuery.php',
'PhabricatorFavoritesApplication' => 'applications/favorites/application/PhabricatorFavoritesApplication.php',
@ -3410,6 +3418,7 @@ phutil_register_library_map(array(
'PhabricatorFlaggableInterface' => 'applications/flag/interface/PhabricatorFlaggableInterface.php',
'PhabricatorFlagsApplication' => 'applications/flag/application/PhabricatorFlagsApplication.php',
'PhabricatorFlagsUIEventListener' => 'applications/flag/events/PhabricatorFlagsUIEventListener.php',
'PhabricatorFullLoginUserLogType' => 'applications/people/userlog/PhabricatorFullLoginUserLogType.php',
'PhabricatorFulltextEngine' => 'applications/search/index/PhabricatorFulltextEngine.php',
'PhabricatorFulltextEngineExtension' => 'applications/search/index/PhabricatorFulltextEngineExtension.php',
'PhabricatorFulltextEngineExtensionModule' => 'applications/search/index/PhabricatorFulltextEngineExtensionModule.php',
@ -3548,7 +3557,10 @@ phutil_register_library_map(array(
'PhabricatorLockLogManagementWorkflow' => 'applications/daemon/management/PhabricatorLockLogManagementWorkflow.php',
'PhabricatorLockManagementWorkflow' => 'applications/daemon/management/PhabricatorLockManagementWorkflow.php',
'PhabricatorLogTriggerAction' => 'infrastructure/daemon/workers/action/PhabricatorLogTriggerAction.php',
'PhabricatorLoginFailureUserLogType' => 'applications/people/userlog/PhabricatorLoginFailureUserLogType.php',
'PhabricatorLoginUserLogType' => 'applications/people/userlog/PhabricatorLoginUserLogType.php',
'PhabricatorLogoutController' => 'applications/auth/controller/PhabricatorLogoutController.php',
'PhabricatorLogoutUserLogType' => 'applications/people/userlog/PhabricatorLogoutUserLogType.php',
'PhabricatorLunarPhasePolicyRule' => 'applications/policy/rule/PhabricatorLunarPhasePolicyRule.php',
'PhabricatorMacroApplication' => 'applications/macro/application/PhabricatorMacroApplication.php',
'PhabricatorMacroAudioBehaviorTransaction' => 'applications/macro/xaction/PhabricatorMacroAudioBehaviorTransaction.php',
@ -3957,6 +3969,7 @@ phutil_register_library_map(array(
'PhabricatorPackagesVersionViewController' => 'applications/packages/controller/PhabricatorPackagesVersionViewController.php',
'PhabricatorPackagesView' => 'applications/packages/view/PhabricatorPackagesView.php',
'PhabricatorPagerUIExample' => 'applications/uiexample/examples/PhabricatorPagerUIExample.php',
'PhabricatorPartialLoginUserLogType' => 'applications/people/userlog/PhabricatorPartialLoginUserLogType.php',
'PhabricatorPassphraseApplication' => 'applications/passphrase/application/PhabricatorPassphraseApplication.php',
'PhabricatorPasswordAuthProvider' => 'applications/auth/provider/PhabricatorPasswordAuthProvider.php',
'PhabricatorPasswordDestructionEngineExtension' => 'applications/auth/extension/PhabricatorPasswordDestructionEngineExtension.php',
@ -4145,6 +4158,7 @@ phutil_register_library_map(array(
'PhabricatorPolicyTestObject' => 'applications/policy/__tests__/PhabricatorPolicyTestObject.php',
'PhabricatorPolicyType' => 'applications/policy/constants/PhabricatorPolicyType.php',
'PhabricatorPonderApplication' => 'applications/ponder/application/PhabricatorPonderApplication.php',
'PhabricatorPrimaryEmailUserLogType' => 'applications/people/userlog/PhabricatorPrimaryEmailUserLogType.php',
'PhabricatorProfileMenuEditEngine' => 'applications/search/editor/PhabricatorProfileMenuEditEngine.php',
'PhabricatorProfileMenuEditor' => 'applications/search/editor/PhabricatorProfileMenuEditor.php',
'PhabricatorProfileMenuEngine' => 'applications/search/engine/PhabricatorProfileMenuEngine.php',
@ -4368,6 +4382,7 @@ phutil_register_library_map(array(
'PhabricatorQueryOrderTestCase' => 'infrastructure/query/order/__tests__/PhabricatorQueryOrderTestCase.php',
'PhabricatorQueryOrderVector' => 'infrastructure/query/order/PhabricatorQueryOrderVector.php',
'PhabricatorRateLimitRequestExceptionHandler' => 'aphront/handler/PhabricatorRateLimitRequestExceptionHandler.php',
'PhabricatorReassignEmailUserLogType' => 'applications/people/userlog/PhabricatorReassignEmailUserLogType.php',
'PhabricatorRebuildIndexesWorker' => 'applications/search/worker/PhabricatorRebuildIndexesWorker.php',
'PhabricatorRecaptchaConfigOptions' => 'applications/config/option/PhabricatorRecaptchaConfigOptions.php',
'PhabricatorRedirectController' => 'applications/base/controller/PhabricatorRedirectController.php',
@ -4386,6 +4401,8 @@ phutil_register_library_map(array(
'PhabricatorRemarkupFigletBlockInterpreter' => 'infrastructure/markup/interpreter/PhabricatorRemarkupFigletBlockInterpreter.php',
'PhabricatorRemarkupHyperlinkEngineExtension' => 'applications/remarkup/engineextension/PhabricatorRemarkupHyperlinkEngineExtension.php',
'PhabricatorRemarkupUIExample' => 'applications/uiexample/examples/PhabricatorRemarkupUIExample.php',
'PhabricatorRemoveEmailUserLogType' => 'applications/people/userlog/PhabricatorRemoveEmailUserLogType.php',
'PhabricatorRemoveMultifactorUserLogType' => 'applications/people/userlog/PhabricatorRemoveMultifactorUserLogType.php',
'PhabricatorRepositoriesSetupCheck' => 'applications/config/check/PhabricatorRepositoriesSetupCheck.php',
'PhabricatorRepository' => 'applications/repository/storage/PhabricatorRepository.php',
'PhabricatorRepositoryActivateTransaction' => 'applications/repository/xaction/PhabricatorRepositoryActivateTransaction.php',
@ -4524,6 +4541,7 @@ phutil_register_library_map(array(
'PhabricatorRepositoryVCSTransaction' => 'applications/repository/xaction/PhabricatorRepositoryVCSTransaction.php',
'PhabricatorRepositoryWorkingCopyVersion' => 'applications/repository/storage/PhabricatorRepositoryWorkingCopyVersion.php',
'PhabricatorRequestExceptionHandler' => 'aphront/handler/PhabricatorRequestExceptionHandler.php',
'PhabricatorResetPasswordUserLogType' => 'applications/people/userlog/PhabricatorResetPasswordUserLogType.php',
'PhabricatorResourceSite' => 'aphront/site/PhabricatorResourceSite.php',
'PhabricatorRobotsController' => 'applications/system/controller/PhabricatorRobotsController.php',
'PhabricatorS3FileStorageEngine' => 'applications/files/engine/PhabricatorS3FileStorageEngine.php',
@ -4630,6 +4648,7 @@ phutil_register_library_map(array(
'PhabricatorShiftChartFunction' => 'applications/fact/chart/PhabricatorShiftChartFunction.php',
'PhabricatorShortSite' => 'aphront/site/PhabricatorShortSite.php',
'PhabricatorShowFiletreeSetting' => 'applications/settings/setting/PhabricatorShowFiletreeSetting.php',
'PhabricatorSignDocumentsUserLogType' => 'applications/people/userlog/PhabricatorSignDocumentsUserLogType.php',
'PhabricatorSimpleEditType' => 'applications/transactions/edittype/PhabricatorSimpleEditType.php',
'PhabricatorSinChartFunction' => 'applications/fact/chart/PhabricatorSinChartFunction.php',
'PhabricatorSite' => 'aphront/site/PhabricatorSite.php',
@ -4920,6 +4939,7 @@ phutil_register_library_map(array(
'PhabricatorUserFulltextEngine' => 'applications/people/search/PhabricatorUserFulltextEngine.php',
'PhabricatorUserIconField' => 'applications/people/customfield/PhabricatorUserIconField.php',
'PhabricatorUserLog' => 'applications/people/storage/PhabricatorUserLog.php',
'PhabricatorUserLogType' => 'applications/people/userlog/PhabricatorUserLogType.php',
'PhabricatorUserLogView' => 'applications/people/view/PhabricatorUserLogView.php',
'PhabricatorUserMessageCountCacheType' => 'applications/people/cache/PhabricatorUserMessageCountCacheType.php',
'PhabricatorUserNotificationCountCacheType' => 'applications/people/cache/PhabricatorUserNotificationCountCacheType.php',
@ -4950,6 +4970,7 @@ phutil_register_library_map(array(
'PhabricatorUsersPolicyRule' => 'applications/people/policyrule/PhabricatorUsersPolicyRule.php',
'PhabricatorUsersSearchField' => 'applications/people/searchfield/PhabricatorUsersSearchField.php',
'PhabricatorVCSResponse' => 'applications/repository/response/PhabricatorVCSResponse.php',
'PhabricatorVerifyEmailUserLogType' => 'applications/people/userlog/PhabricatorVerifyEmailUserLogType.php',
'PhabricatorVersionedDraft' => 'applications/draft/storage/PhabricatorVersionedDraft.php',
'PhabricatorVeryWowEnglishTranslation' => 'infrastructure/internationalization/translation/PhabricatorVeryWowEnglishTranslation.php',
'PhabricatorVideoDocumentEngine' => 'applications/files/document/PhabricatorVideoDocumentEngine.php',
@ -8051,6 +8072,8 @@ phutil_register_library_map(array(
'PhabricatorActionListView' => 'AphrontTagView',
'PhabricatorActionView' => 'AphrontView',
'PhabricatorActivitySettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorAddEmailUserLogType' => 'PhabricatorUserLogType',
'PhabricatorAddMultifactorUserLogType' => 'PhabricatorUserLogType',
'PhabricatorAdministratorsPolicyRule' => 'PhabricatorPolicyRule',
'PhabricatorAjaxRequestExceptionHandler' => 'PhabricatorRequestExceptionHandler',
'PhabricatorAlmanacApplication' => 'PhabricatorApplication',
@ -8716,6 +8739,7 @@ phutil_register_library_map(array(
'PhabricatorCelerityApplication' => 'PhabricatorApplication',
'PhabricatorCelerityTestCase' => 'PhabricatorTestCase',
'PhabricatorChangeParserTestCase' => 'PhabricatorWorkingCopyTestCase',
'PhabricatorChangePasswordUserLogType' => 'PhabricatorUserLogType',
'PhabricatorChangesetCachePurger' => 'PhabricatorCachePurger',
'PhabricatorChangesetResponse' => 'AphrontProxyResponse',
'PhabricatorChartAxis' => 'Phobject',
@ -8774,7 +8798,9 @@ phutil_register_library_map(array(
'PhabricatorConduitAPIController' => 'PhabricatorConduitController',
'PhabricatorConduitApplication' => 'PhabricatorApplication',
'PhabricatorConduitCallManagementWorkflow' => 'PhabricatorConduitManagementWorkflow',
'PhabricatorConduitCertificateFailureUserLogType' => 'PhabricatorUserLogType',
'PhabricatorConduitCertificateToken' => 'PhabricatorConduitDAO',
'PhabricatorConduitCertificateUserLogType' => 'PhabricatorUserLogType',
'PhabricatorConduitConsoleController' => 'PhabricatorConduitController',
'PhabricatorConduitContentSource' => 'PhabricatorContentSource',
'PhabricatorConduitController' => 'PhabricatorController',
@ -9329,6 +9355,7 @@ phutil_register_library_map(array(
'PhabricatorEmojiRemarkupRule' => 'PhutilRemarkupRule',
'PhabricatorEmojiTranslation' => 'PhutilTranslation',
'PhabricatorEmptyQueryException' => 'Exception',
'PhabricatorEnterHisecUserLogType' => 'PhabricatorUserLogType',
'PhabricatorEnumConfigType' => 'PhabricatorTextConfigType',
'PhabricatorEnv' => 'Phobject',
'PhabricatorEnvTestCase' => 'PhabricatorTestCase',
@ -9341,6 +9368,7 @@ phutil_register_library_map(array(
'PhabricatorExampleEventListener' => 'PhabricatorEventListener',
'PhabricatorExcelExportFormat' => 'PhabricatorExportFormat',
'PhabricatorExecFutureFileUploadSource' => 'PhabricatorFileUploadSource',
'PhabricatorExitHisecUserLogType' => 'PhabricatorUserLogType',
'PhabricatorExportEngine' => 'Phobject',
'PhabricatorExportEngineBulkJobType' => 'PhabricatorWorkerSingleBulkJobType',
'PhabricatorExportEngineExtension' => 'Phobject',
@ -9386,6 +9414,7 @@ phutil_register_library_map(array(
'PhabricatorFactObjectDimension' => 'PhabricatorFactDimension',
'PhabricatorFactRaw' => 'PhabricatorFactDAO',
'PhabricatorFactUpdateIterator' => 'PhutilBufferedIterator',
'PhabricatorFailHisecUserLogType' => 'PhabricatorUserLogType',
'PhabricatorFaviconRef' => 'Phobject',
'PhabricatorFaviconRefQuery' => 'Phobject',
'PhabricatorFavoritesApplication' => 'PhabricatorApplication',
@ -9557,6 +9586,7 @@ phutil_register_library_map(array(
'PhabricatorFlaggableInterface' => 'PhabricatorPHIDInterface',
'PhabricatorFlagsApplication' => 'PhabricatorApplication',
'PhabricatorFlagsUIEventListener' => 'PhabricatorEventListener',
'PhabricatorFullLoginUserLogType' => 'PhabricatorUserLogType',
'PhabricatorFulltextEngine' => 'Phobject',
'PhabricatorFulltextEngineExtension' => 'Phobject',
'PhabricatorFulltextEngineExtensionModule' => 'PhabricatorConfigModule',
@ -9702,7 +9732,10 @@ phutil_register_library_map(array(
'PhabricatorLockLogManagementWorkflow' => 'PhabricatorLockManagementWorkflow',
'PhabricatorLockManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorLogTriggerAction' => 'PhabricatorTriggerAction',
'PhabricatorLoginFailureUserLogType' => 'PhabricatorUserLogType',
'PhabricatorLoginUserLogType' => 'PhabricatorUserLogType',
'PhabricatorLogoutController' => 'PhabricatorAuthController',
'PhabricatorLogoutUserLogType' => 'PhabricatorUserLogType',
'PhabricatorLunarPhasePolicyRule' => 'PhabricatorPolicyRule',
'PhabricatorMacroApplication' => 'PhabricatorApplication',
'PhabricatorMacroAudioBehaviorTransaction' => 'PhabricatorMacroTransactionType',
@ -10182,6 +10215,7 @@ phutil_register_library_map(array(
'PhabricatorPackagesVersionViewController' => 'PhabricatorPackagesVersionController',
'PhabricatorPackagesView' => 'AphrontView',
'PhabricatorPagerUIExample' => 'PhabricatorUIExample',
'PhabricatorPartialLoginUserLogType' => 'PhabricatorUserLogType',
'PhabricatorPassphraseApplication' => 'PhabricatorApplication',
'PhabricatorPasswordAuthProvider' => 'PhabricatorAuthProvider',
'PhabricatorPasswordDestructionEngineExtension' => 'PhabricatorDestructionEngineExtension',
@ -10402,6 +10436,7 @@ phutil_register_library_map(array(
),
'PhabricatorPolicyType' => 'PhabricatorPolicyConstants',
'PhabricatorPonderApplication' => 'PhabricatorApplication',
'PhabricatorPrimaryEmailUserLogType' => 'PhabricatorUserLogType',
'PhabricatorProfileMenuEditEngine' => 'PhabricatorEditEngine',
'PhabricatorProfileMenuEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorProfileMenuEngine' => 'Phobject',
@ -10669,6 +10704,7 @@ phutil_register_library_map(array(
'Iterator',
),
'PhabricatorRateLimitRequestExceptionHandler' => 'PhabricatorRequestExceptionHandler',
'PhabricatorReassignEmailUserLogType' => 'PhabricatorUserLogType',
'PhabricatorRebuildIndexesWorker' => 'PhabricatorWorker',
'PhabricatorRecaptchaConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorRedirectController' => 'PhabricatorController',
@ -10687,6 +10723,8 @@ phutil_register_library_map(array(
'PhabricatorRemarkupFigletBlockInterpreter' => 'PhutilRemarkupBlockInterpreter',
'PhabricatorRemarkupHyperlinkEngineExtension' => 'PhutilRemarkupHyperlinkEngineExtension',
'PhabricatorRemarkupUIExample' => 'PhabricatorUIExample',
'PhabricatorRemoveEmailUserLogType' => 'PhabricatorUserLogType',
'PhabricatorRemoveMultifactorUserLogType' => 'PhabricatorUserLogType',
'PhabricatorRepositoriesSetupCheck' => 'PhabricatorSetupCheck',
'PhabricatorRepository' => array(
'PhabricatorRepositoryDAO',
@ -10894,6 +10932,7 @@ phutil_register_library_map(array(
'PhabricatorRepositoryVCSTransaction' => 'PhabricatorRepositoryTransactionType',
'PhabricatorRepositoryWorkingCopyVersion' => 'PhabricatorRepositoryDAO',
'PhabricatorRequestExceptionHandler' => 'AphrontRequestExceptionHandler',
'PhabricatorResetPasswordUserLogType' => 'PhabricatorUserLogType',
'PhabricatorResourceSite' => 'PhabricatorSite',
'PhabricatorRobotsController' => 'PhabricatorController',
'PhabricatorS3FileStorageEngine' => 'PhabricatorFileStorageEngine',
@ -11002,6 +11041,7 @@ phutil_register_library_map(array(
'PhabricatorShiftChartFunction' => 'PhabricatorChartFunction',
'PhabricatorShortSite' => 'PhabricatorSite',
'PhabricatorShowFiletreeSetting' => 'PhabricatorSelectSetting',
'PhabricatorSignDocumentsUserLogType' => 'PhabricatorUserLogType',
'PhabricatorSimpleEditType' => 'PhabricatorEditType',
'PhabricatorSinChartFunction' => 'PhabricatorChartFunction',
'PhabricatorSite' => 'AphrontSite',
@ -11336,6 +11376,7 @@ phutil_register_library_map(array(
'PhabricatorUserDAO',
'PhabricatorPolicyInterface',
),
'PhabricatorUserLogType' => 'Phobject',
'PhabricatorUserLogView' => 'AphrontView',
'PhabricatorUserMessageCountCacheType' => 'PhabricatorUserCacheType',
'PhabricatorUserNotificationCountCacheType' => 'PhabricatorUserCacheType',
@ -11371,6 +11412,7 @@ phutil_register_library_map(array(
'PhabricatorUsersPolicyRule' => 'PhabricatorPolicyRule',
'PhabricatorUsersSearchField' => 'PhabricatorSearchTokenizerField',
'PhabricatorVCSResponse' => 'AphrontResponse',
'PhabricatorVerifyEmailUserLogType' => 'PhabricatorUserLogType',
'PhabricatorVersionedDraft' => 'PhabricatorDraftDAO',
'PhabricatorVeryWowEnglishTranslation' => 'PhutilTranslation',
'PhabricatorVideoDocumentEngine' => 'PhabricatorDocumentEngine',

View file

@ -294,8 +294,8 @@ final class PhabricatorAuthSessionEngine extends Phobject {
null,
$identity_phid,
($partial
? PhabricatorUserLog::ACTION_LOGIN_PARTIAL
: PhabricatorUserLog::ACTION_LOGIN));
? PhabricatorPartialLoginUserLogType::LOGTYPE
: PhabricatorLoginUserLogType::LOGTYPE));
$log->setDetails(
array(
@ -366,7 +366,7 @@ final class PhabricatorAuthSessionEngine extends Phobject {
$log = PhabricatorUserLog::initializeNewLog(
$user,
$user->getPHID(),
PhabricatorUserLog::ACTION_LOGOUT);
PhabricatorLogoutUserLogType::LOGTYPE);
$log->save();
$extensions = PhabricatorAuthSessionEngineExtension::getAllExtensions();
@ -688,13 +688,13 @@ final class PhabricatorAuthSessionEngine extends Phobject {
$log = PhabricatorUserLog::initializeNewLog(
$viewer,
$viewer->getPHID(),
PhabricatorUserLog::ACTION_ENTER_HISEC);
PhabricatorEnterHisecUserLogType::LOGTYPE);
$log->save();
} else {
$log = PhabricatorUserLog::initializeNewLog(
$viewer,
$viewer->getPHID(),
PhabricatorUserLog::ACTION_FAIL_HISEC);
PhabricatorFailHisecUserLogType::LOGTYPE);
$log->save();
}
}
@ -831,7 +831,7 @@ final class PhabricatorAuthSessionEngine extends Phobject {
$log = PhabricatorUserLog::initializeNewLog(
$viewer,
$viewer->getPHID(),
PhabricatorUserLog::ACTION_EXIT_HISEC);
PhabricatorExitHisecUserLogType::LOGTYPE);
$log->save();
}
@ -872,7 +872,7 @@ final class PhabricatorAuthSessionEngine extends Phobject {
$log = PhabricatorUserLog::initializeNewLog(
$viewer,
$viewer->getPHID(),
PhabricatorUserLog::ACTION_LOGIN_FULL);
PhabricatorFullLoginUserLogType::LOGTYPE);
$log->save();
unset($unguarded);
}
@ -917,7 +917,7 @@ final class PhabricatorAuthSessionEngine extends Phobject {
$log = PhabricatorUserLog::initializeNewLog(
$viewer,
$viewer->getPHID(),
PhabricatorUserLog::ACTION_LOGIN_LEGALPAD);
PhabricatorSignDocumentsUserLogType::LOGTYPE);
$log->save();
}
unset($unguarded);

View file

@ -318,7 +318,7 @@ final class PhabricatorPasswordAuthProvider extends PhabricatorAuthProvider {
$log = PhabricatorUserLog::initializeNewLog(
null,
$log_user ? $log_user->getPHID() : null,
PhabricatorUserLog::ACTION_LOGIN_FAILURE);
PhabricatorLoginFailureUserLogType::LOGTYPE);
$log->save();
}

View file

@ -41,7 +41,7 @@ final class ConduitGetCertificateConduitAPIMethod extends ConduitAPIMethod {
protected function execute(ConduitAPIRequest $request) {
$failed_attempts = PhabricatorUserLog::loadRecentEventsFromThisIP(
PhabricatorUserLog::ACTION_CONDUIT_CERTIFICATE_FAILURE,
PhabricatorConduitCertificateFailureUserLogType::LOGTYPE,
60 * 5);
if (count($failed_attempts) > 5) {
@ -61,7 +61,7 @@ final class ConduitGetCertificateConduitAPIMethod extends ConduitAPIMethod {
$log = PhabricatorUserLog::initializeNewLog(
$request->getUser(),
$info->getUserPHID(),
PhabricatorUserLog::ACTION_CONDUIT_CERTIFICATE)
PhabricatorConduitCertificateUserLogType::LOGTYPE)
->save();
}
@ -85,7 +85,7 @@ final class ConduitGetCertificateConduitAPIMethod extends ConduitAPIMethod {
$log = PhabricatorUserLog::initializeNewLog(
$request->getUser(),
$info ? $info->getUserPHID() : '-',
PhabricatorUserLog::ACTION_CONDUIT_CERTIFICATE_FAILURE)
PhabricatorConduitCertificateFailureUserLogType::LOGTYPE)
->save();
}

View file

@ -78,7 +78,7 @@ final class PhabricatorUserEditor extends PhabricatorEditor {
$log = PhabricatorUserLog::initializeNewLog(
$this->requireActor(),
$user->getPHID(),
PhabricatorUserLog::ACTION_EMAIL_REASSIGN);
PhabricatorReassignEmailUserLogType::LOGTYPE);
$log->setNewValue($email->getAddress());
$log->save();
}
@ -195,7 +195,7 @@ final class PhabricatorUserEditor extends PhabricatorEditor {
$log = PhabricatorUserLog::initializeNewLog(
$actor,
$user->getPHID(),
PhabricatorUserLog::ACTION_EMAIL_ADD);
PhabricatorAddEmailUserLogType::LOGTYPE);
$log->setNewValue($email->getAddress());
$log->save();
@ -246,7 +246,7 @@ final class PhabricatorUserEditor extends PhabricatorEditor {
$log = PhabricatorUserLog::initializeNewLog(
$actor,
$user->getPHID(),
PhabricatorUserLog::ACTION_EMAIL_REMOVE);
PhabricatorRemoveEmailUserLogType::LOGTYPE);
$log->setOldValue($email->getAddress());
$log->save();
@ -312,7 +312,7 @@ final class PhabricatorUserEditor extends PhabricatorEditor {
$log = PhabricatorUserLog::initializeNewLog(
$actor,
$user->getPHID(),
PhabricatorUserLog::ACTION_EMAIL_PRIMARY);
PhabricatorPrimaryEmailUserLogType::LOGTYPE);
$log->setOldValue($old_primary ? $old_primary->getAddress() : null);
$log->setNewValue($email->getAddress());
@ -371,7 +371,7 @@ final class PhabricatorUserEditor extends PhabricatorEditor {
$log = PhabricatorUserLog::initializeNewLog(
$actor,
$user->getPHID(),
PhabricatorUserLog::ACTION_EMAIL_VERIFY);
PhabricatorVerifyEmailUserLogType::LOGTYPE);
$log->setNewValue($email->getAddress());
$log->save();
}
@ -433,7 +433,7 @@ final class PhabricatorUserEditor extends PhabricatorEditor {
$log = PhabricatorUserLog::initializeNewLog(
$actor,
$user->getPHID(),
PhabricatorUserLog::ACTION_EMAIL_REASSIGN);
PhabricatorReassignEmailUserLogType::LOGTYPE);
$log->setNewValue($email->getAddress());
$log->save();
}

View file

@ -64,6 +64,9 @@ final class PhabricatorPeopleLogSearchEngine
}
protected function buildCustomSearchFields() {
$types = PhabricatorUserLogType::getAllLogTypes();
$types = mpull($types, 'getLogTypeName', 'getLogTypeKey');
return array(
id(new PhabricatorUsersSearchField())
->setKey('userPHIDs')
@ -79,7 +82,7 @@ final class PhabricatorPeopleLogSearchEngine
->setKey('actions')
->setLabel(pht('Actions'))
->setDescription(pht('Search for particular types of activity.'))
->setOptions(PhabricatorUserLog::getActionTypeMap()),
->setOptions($types),
id(new PhabricatorSearchTextField())
->setKey('ip')
->setLabel(pht('Filter IP'))
@ -194,7 +197,8 @@ final class PhabricatorPeopleLogSearchEngine
}
$handles = $viewer->loadHandles($phids);
$action_map = PhabricatorUserLog::getActionTypeMap();
$types = PhabricatorUserLogType::getAllLogTypes();
$types = mpull($types, 'getLogTypeName', 'getLogTypeKey');
$export = array();
foreach ($logs as $log) {
@ -214,7 +218,7 @@ final class PhabricatorPeopleLogSearchEngine
}
$action = $log->getAction();
$action_name = idx($action_map, $action, pht('Unknown ("%s")', $action));
$action_name = idx($types, $action, pht('Unknown ("%s")', $action));
$map = array(
'actorPHID' => $actor_phid,

View file

@ -3,32 +3,6 @@
final class PhabricatorUserLog extends PhabricatorUserDAO
implements PhabricatorPolicyInterface {
const ACTION_LOGIN = 'login';
const ACTION_LOGIN_PARTIAL = 'login-partial';
const ACTION_LOGIN_FULL = 'login-full';
const ACTION_LOGOUT = 'logout';
const ACTION_LOGIN_FAILURE = 'login-fail';
const ACTION_LOGIN_LEGALPAD = 'login-legalpad';
const ACTION_RESET_PASSWORD = 'reset-pass';
const ACTION_CONDUIT_CERTIFICATE = 'conduit-cert';
const ACTION_CONDUIT_CERTIFICATE_FAILURE = 'conduit-cert-fail';
const ACTION_EMAIL_PRIMARY = 'email-primary';
const ACTION_EMAIL_REMOVE = 'email-remove';
const ACTION_EMAIL_ADD = 'email-add';
const ACTION_EMAIL_VERIFY = 'email-verify';
const ACTION_EMAIL_REASSIGN = 'email-reassign';
const ACTION_CHANGE_PASSWORD = 'change-password';
const ACTION_ENTER_HISEC = 'hisec-enter';
const ACTION_EXIT_HISEC = 'hisec-exit';
const ACTION_FAIL_HISEC = 'hisec-fail';
const ACTION_MULTI_ADD = 'multi-add';
const ACTION_MULTI_REMOVE = 'multi-remove';
protected $actorPHID;
protected $userPHID;
protected $action;
@ -38,35 +12,6 @@ final class PhabricatorUserLog extends PhabricatorUserDAO
protected $remoteAddr;
protected $session;
public static function getActionTypeMap() {
return array(
self::ACTION_LOGIN => pht('Login'),
self::ACTION_LOGIN_PARTIAL => pht('Login: Partial Login'),
self::ACTION_LOGIN_FULL => pht('Login: Upgrade to Full'),
self::ACTION_LOGIN_FAILURE => pht('Login: Failure'),
self::ACTION_LOGIN_LEGALPAD =>
pht('Login: Signed Required Legalpad Documents'),
self::ACTION_LOGOUT => pht('Logout'),
self::ACTION_RESET_PASSWORD => pht('Reset Password'),
self::ACTION_CONDUIT_CERTIFICATE
=> pht('Conduit: Read Certificate'),
self::ACTION_CONDUIT_CERTIFICATE_FAILURE
=> pht('Conduit: Read Certificate Failure'),
self::ACTION_EMAIL_PRIMARY => pht('Email: Change Primary'),
self::ACTION_EMAIL_ADD => pht('Email: Add Address'),
self::ACTION_EMAIL_REMOVE => pht('Email: Remove Address'),
self::ACTION_EMAIL_VERIFY => pht('Email: Verify'),
self::ACTION_EMAIL_REASSIGN => pht('Email: Reassign'),
self::ACTION_CHANGE_PASSWORD => pht('Change Password'),
self::ACTION_ENTER_HISEC => pht('Hisec: Enter'),
self::ACTION_EXIT_HISEC => pht('Hisec: Exit'),
self::ACTION_FAIL_HISEC => pht('Hisec: Failed Attempt'),
self::ACTION_MULTI_ADD => pht('Multi-Factor: Add Factor'),
self::ACTION_MULTI_REMOVE => pht('Multi-Factor: Remove Factor'),
);
}
public static function initializeNewLog(
PhabricatorUser $actor = null,
$object_phid = null,

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorAddEmailUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'email-add';
public function getLogTypeName() {
return pht('Email: Add Address');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorAddMultifactorUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'multi-add';
public function getLogTypeName() {
return pht('Multi-Factor: Add Factor');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorChangePasswordUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'change-password';
public function getLogTypeName() {
return pht('Change Password');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorConduitCertificateFailureUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'conduit-cert-fail';
public function getLogTypeName() {
return pht('Conduit: Read Certificate Failure');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorConduitCertificateUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'conduit-cert';
public function getLogTypeName() {
return pht('Conduit: Read Certificate');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorEnterHisecUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'hisec-enter';
public function getLogTypeName() {
return pht('Hisec: Enter');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorExitHisecUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'hisec-exit';
public function getLogTypeName() {
return pht('Hisec: Exit');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorFailHisecUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'hisec-fail';
public function getLogTypeName() {
return pht('Hisec: Failed Attempt');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorFullLoginUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'login-full';
public function getLogTypeName() {
return pht('Login: Upgrade to Full');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorLoginFailureUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'login-fail';
public function getLogTypeName() {
return pht('Login: Failure');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorLoginUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'login';
public function getLogTypeName() {
return pht('Login');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorLogoutUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'logout';
public function getLogTypeName() {
return pht('Logout');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorPartialLoginUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'login-partial';
public function getLogTypeName() {
return pht('Login: Partial Login');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorPrimaryEmailUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'email-primary';
public function getLogTypeName() {
return pht('Email: Change Primary');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorReassignEmailUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'email-reassign';
public function getLogTypeName() {
return pht('Email: Reassign');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorRemoveEmailUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'email-remove';
public function getLogTypeName() {
return pht('Email: Remove Address');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorRemoveMultifactorUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'multi-remove';
public function getLogTypeName() {
return pht('Multi-Factor: Remove Factor');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorResetPasswordUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'reset-pass';
public function getLogTypeName() {
return pht('Reset Password');
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorSignDocumentsUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'login-legalpad';
public function getLogTypeName() {
return pht('Login: Signed Required Legalpad Documents');
}
}

View file

@ -0,0 +1,19 @@
<?php
abstract class PhabricatorUserLogType
extends Phobject {
final public function getLogTypeKey() {
return $this->getPhobjectClassConstant('LOGTYPE', 32);
}
abstract public function getLogTypeName();
final public static function getAllLogTypes() {
return id(new PhutilClassMapQuery())
->setAncestorClass(__CLASS__)
->setUniqueMethod('getLogTypeKey')
->execute();
}
}

View file

@ -0,0 +1,12 @@
<?php
final class PhabricatorVerifyEmailUserLogType
extends PhabricatorUserLogType {
const LOGTYPE = 'email-verify';
public function getLogTypeName() {
return pht('Email: Verify Address');
}
}

View file

@ -27,7 +27,9 @@ final class PhabricatorUserLogView extends AphrontView {
}
$handles = $viewer->loadHandles($phids);
$action_map = PhabricatorUserLog::getActionTypeMap();
$types = PhabricatorUserLogType::getAllLogTypes();
$types = mpull($types, 'getLogTypeName', 'getLogTypeKey');
$base_uri = $this->searchBaseURI;
$viewer_phid = $viewer->getPHID();
@ -69,7 +71,7 @@ final class PhabricatorUserLogView extends AphrontView {
}
$action = $log->getAction();
$action_name = idx($action_map, $action, $action);
$action_name = idx($types, $action, $action);
if ($actor_phid) {
$actor_name = $handles[$actor_phid]->renderLink();

View file

@ -315,7 +315,7 @@ final class PhabricatorMultiFactorSettingsPanel
$log = PhabricatorUserLog::initializeNewLog(
$viewer,
$user->getPHID(),
PhabricatorUserLog::ACTION_MULTI_ADD);
PhabricatorAddMultifactorUserLogType::LOGTYPE);
$log->save();
$user->updateMultiFactorEnrollment();
@ -423,7 +423,7 @@ final class PhabricatorMultiFactorSettingsPanel
$log = PhabricatorUserLog::initializeNewLog(
$viewer,
$user->getPHID(),
PhabricatorUserLog::ACTION_MULTI_REMOVE);
PhabricatorRemoveMultifactorUserLogType::LOGTYPE);
$log->save();
$user->updateMultiFactorEnrollment();