1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 01:10:58 +01:00

Tie application event listeners to the applications they listen for

Summary:
Ref T3675. Some of these listeners shouldn't do their thing if the viewer doesn't have access to an application (for example, users without access to Differential should not be able to "Edit Tasks"). Set the stage for that:

  - Introduce `PhabricatorEventListener`, which has an application.
  - Populate this for event listeners installed by applications.
  - Rename the "PeopleMenu" listeners to "ActionMenu" listeners, which better describes their modern behavior.

This doesn't actually change any behaviors.

Test Plan: Viewed Maniphest, Differntial, People.

Reviewers: btrahan, chad

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T3675

Differential Revision: https://secure.phabricator.com/D7364
This commit is contained in:
epriestley 2013-10-21 17:00:21 -07:00
parent c69beb7988
commit d66972c9f2
26 changed files with 88 additions and 46 deletions

View file

@ -90,7 +90,7 @@ phutil_register_library_map(array(
'AphrontUsageException' => 'aphront/exception/AphrontUsageException.php', 'AphrontUsageException' => 'aphront/exception/AphrontUsageException.php',
'AphrontView' => 'view/AphrontView.php', 'AphrontView' => 'view/AphrontView.php',
'AphrontWebpageResponse' => 'aphront/response/AphrontWebpageResponse.php', 'AphrontWebpageResponse' => 'aphront/response/AphrontWebpageResponse.php',
'AuditPeopleMenuEventListener' => 'applications/audit/events/AuditPeopleMenuEventListener.php', 'AuditActionMenuEventListener' => 'applications/audit/events/AuditActionMenuEventListener.php',
'CelerityAPI' => 'infrastructure/celerity/CelerityAPI.php', 'CelerityAPI' => 'infrastructure/celerity/CelerityAPI.php',
'CelerityPhabricatorResourceController' => 'infrastructure/celerity/CelerityPhabricatorResourceController.php', 'CelerityPhabricatorResourceController' => 'infrastructure/celerity/CelerityPhabricatorResourceController.php',
'CelerityResourceController' => 'infrastructure/celerity/CelerityResourceController.php', 'CelerityResourceController' => 'infrastructure/celerity/CelerityResourceController.php',
@ -244,6 +244,7 @@ phutil_register_library_map(array(
'ConduitCallTestCase' => 'applications/conduit/call/__tests__/ConduitCallTestCase.php', 'ConduitCallTestCase' => 'applications/conduit/call/__tests__/ConduitCallTestCase.php',
'ConduitException' => 'applications/conduit/protocol/ConduitException.php', 'ConduitException' => 'applications/conduit/protocol/ConduitException.php',
'ConduitSSHWorkflow' => 'applications/conduit/ssh/ConduitSSHWorkflow.php', 'ConduitSSHWorkflow' => 'applications/conduit/ssh/ConduitSSHWorkflow.php',
'ConpherenceActionMenuEventListener' => 'applications/conpherence/events/ConpherenceActionMenuEventListener.php',
'ConpherenceConfigOptions' => 'applications/conpherence/config/ConpherenceConfigOptions.php', 'ConpherenceConfigOptions' => 'applications/conpherence/config/ConpherenceConfigOptions.php',
'ConpherenceConstants' => 'applications/conpherence/constants/ConpherenceConstants.php', 'ConpherenceConstants' => 'applications/conpherence/constants/ConpherenceConstants.php',
'ConpherenceController' => 'applications/conpherence/controller/ConpherenceController.php', 'ConpherenceController' => 'applications/conpherence/controller/ConpherenceController.php',
@ -261,7 +262,6 @@ phutil_register_library_map(array(
'ConpherenceParticipantCountQuery' => 'applications/conpherence/query/ConpherenceParticipantCountQuery.php', 'ConpherenceParticipantCountQuery' => 'applications/conpherence/query/ConpherenceParticipantCountQuery.php',
'ConpherenceParticipantQuery' => 'applications/conpherence/query/ConpherenceParticipantQuery.php', 'ConpherenceParticipantQuery' => 'applications/conpherence/query/ConpherenceParticipantQuery.php',
'ConpherenceParticipationStatus' => 'applications/conpherence/constants/ConpherenceParticipationStatus.php', 'ConpherenceParticipationStatus' => 'applications/conpherence/constants/ConpherenceParticipationStatus.php',
'ConpherencePeopleMenuEventListener' => 'applications/conpherence/events/ConpherencePeopleMenuEventListener.php',
'ConpherencePeopleWidgetView' => 'applications/conpherence/view/ConpherencePeopleWidgetView.php', 'ConpherencePeopleWidgetView' => 'applications/conpherence/view/ConpherencePeopleWidgetView.php',
'ConpherenceReplyHandler' => 'applications/conpherence/mail/ConpherenceReplyHandler.php', 'ConpherenceReplyHandler' => 'applications/conpherence/mail/ConpherenceReplyHandler.php',
'ConpherenceSettings' => 'applications/conpherence/constants/ConpherenceSettings.php', 'ConpherenceSettings' => 'applications/conpherence/constants/ConpherenceSettings.php',
@ -297,6 +297,7 @@ phutil_register_library_map(array(
'DefaultDatabaseConfigurationProvider' => 'infrastructure/storage/configuration/DefaultDatabaseConfigurationProvider.php', 'DefaultDatabaseConfigurationProvider' => 'infrastructure/storage/configuration/DefaultDatabaseConfigurationProvider.php',
'DifferentialAction' => 'applications/differential/constants/DifferentialAction.php', 'DifferentialAction' => 'applications/differential/constants/DifferentialAction.php',
'DifferentialActionHasNoEffectException' => 'applications/differential/exception/DifferentialActionHasNoEffectException.php', 'DifferentialActionHasNoEffectException' => 'applications/differential/exception/DifferentialActionHasNoEffectException.php',
'DifferentialActionMenuEventListener' => 'applications/differential/events/DifferentialActionMenuEventListener.php',
'DifferentialAddCommentView' => 'applications/differential/view/DifferentialAddCommentView.php', 'DifferentialAddCommentView' => 'applications/differential/view/DifferentialAddCommentView.php',
'DifferentialAffectedPath' => 'applications/differential/storage/DifferentialAffectedPath.php', 'DifferentialAffectedPath' => 'applications/differential/storage/DifferentialAffectedPath.php',
'DifferentialApplyPatchFieldSpecification' => 'applications/differential/field/specification/DifferentialApplyPatchFieldSpecification.php', 'DifferentialApplyPatchFieldSpecification' => 'applications/differential/field/specification/DifferentialApplyPatchFieldSpecification.php',
@ -390,7 +391,6 @@ phutil_register_library_map(array(
'DifferentialPHIDTypeRevision' => 'applications/differential/phid/DifferentialPHIDTypeRevision.php', 'DifferentialPHIDTypeRevision' => 'applications/differential/phid/DifferentialPHIDTypeRevision.php',
'DifferentialParseRenderTestCase' => 'applications/differential/__tests__/DifferentialParseRenderTestCase.php', 'DifferentialParseRenderTestCase' => 'applications/differential/__tests__/DifferentialParseRenderTestCase.php',
'DifferentialPathFieldSpecification' => 'applications/differential/field/specification/DifferentialPathFieldSpecification.php', 'DifferentialPathFieldSpecification' => 'applications/differential/field/specification/DifferentialPathFieldSpecification.php',
'DifferentialPeopleMenuEventListener' => 'applications/differential/events/DifferentialPeopleMenuEventListener.php',
'DifferentialPrimaryPaneView' => 'applications/differential/view/DifferentialPrimaryPaneView.php', 'DifferentialPrimaryPaneView' => 'applications/differential/view/DifferentialPrimaryPaneView.php',
'DifferentialProjectReviewersFieldSpecification' => 'applications/differential/field/specification/DifferentialProjectReviewersFieldSpecification.php', 'DifferentialProjectReviewersFieldSpecification' => 'applications/differential/field/specification/DifferentialProjectReviewersFieldSpecification.php',
'DifferentialRawDiffRenderer' => 'applications/differential/render/DifferentialRawDiffRenderer.php', 'DifferentialRawDiffRenderer' => 'applications/differential/render/DifferentialRawDiffRenderer.php',
@ -704,6 +704,7 @@ phutil_register_library_map(array(
'LiskIsolationTestDAOException' => 'infrastructure/storage/lisk/__tests__/LiskIsolationTestDAOException.php', 'LiskIsolationTestDAOException' => 'infrastructure/storage/lisk/__tests__/LiskIsolationTestDAOException.php',
'LiskMigrationIterator' => 'infrastructure/storage/lisk/LiskMigrationIterator.php', 'LiskMigrationIterator' => 'infrastructure/storage/lisk/LiskMigrationIterator.php',
'LiskRawMigrationIterator' => 'infrastructure/storage/lisk/LiskRawMigrationIterator.php', 'LiskRawMigrationIterator' => 'infrastructure/storage/lisk/LiskRawMigrationIterator.php',
'ManiphestActionMenuEventListener' => 'applications/maniphest/event/ManiphestActionMenuEventListener.php',
'ManiphestBatchEditController' => 'applications/maniphest/controller/ManiphestBatchEditController.php', 'ManiphestBatchEditController' => 'applications/maniphest/controller/ManiphestBatchEditController.php',
'ManiphestCapabilityBulkEdit' => 'applications/maniphest/capability/ManiphestCapabilityBulkEdit.php', 'ManiphestCapabilityBulkEdit' => 'applications/maniphest/capability/ManiphestCapabilityBulkEdit.php',
'ManiphestCapabilityDefaultEdit' => 'applications/maniphest/capability/ManiphestCapabilityDefaultEdit.php', 'ManiphestCapabilityDefaultEdit' => 'applications/maniphest/capability/ManiphestCapabilityDefaultEdit.php',
@ -730,7 +731,6 @@ phutil_register_library_map(array(
'ManiphestNameIndex' => 'applications/maniphest/storage/ManiphestNameIndex.php', 'ManiphestNameIndex' => 'applications/maniphest/storage/ManiphestNameIndex.php',
'ManiphestNameIndexEventListener' => 'applications/maniphest/event/ManiphestNameIndexEventListener.php', 'ManiphestNameIndexEventListener' => 'applications/maniphest/event/ManiphestNameIndexEventListener.php',
'ManiphestPHIDTypeTask' => 'applications/maniphest/phid/ManiphestPHIDTypeTask.php', 'ManiphestPHIDTypeTask' => 'applications/maniphest/phid/ManiphestPHIDTypeTask.php',
'ManiphestPeopleMenuEventListener' => 'applications/maniphest/event/ManiphestPeopleMenuEventListener.php',
'ManiphestRemarkupRule' => 'applications/maniphest/remarkup/ManiphestRemarkupRule.php', 'ManiphestRemarkupRule' => 'applications/maniphest/remarkup/ManiphestRemarkupRule.php',
'ManiphestReplyHandler' => 'applications/maniphest/mail/ManiphestReplyHandler.php', 'ManiphestReplyHandler' => 'applications/maniphest/mail/ManiphestReplyHandler.php',
'ManiphestReportController' => 'applications/maniphest/controller/ManiphestReportController.php', 'ManiphestReportController' => 'applications/maniphest/controller/ManiphestReportController.php',
@ -1157,6 +1157,7 @@ phutil_register_library_map(array(
'PhabricatorErrorExample' => 'applications/uiexample/examples/PhabricatorErrorExample.php', 'PhabricatorErrorExample' => 'applications/uiexample/examples/PhabricatorErrorExample.php',
'PhabricatorEvent' => 'infrastructure/events/PhabricatorEvent.php', 'PhabricatorEvent' => 'infrastructure/events/PhabricatorEvent.php',
'PhabricatorEventEngine' => 'infrastructure/events/PhabricatorEventEngine.php', 'PhabricatorEventEngine' => 'infrastructure/events/PhabricatorEventEngine.php',
'PhabricatorEventListener' => 'infrastructure/events/PhabricatorEventListener.php',
'PhabricatorEventType' => 'infrastructure/events/constant/PhabricatorEventType.php', 'PhabricatorEventType' => 'infrastructure/events/constant/PhabricatorEventType.php',
'PhabricatorExampleEventListener' => 'infrastructure/events/PhabricatorExampleEventListener.php', 'PhabricatorExampleEventListener' => 'infrastructure/events/PhabricatorExampleEventListener.php',
'PhabricatorExtendingPhabricatorConfigOptions' => 'applications/config/option/PhabricatorExtendingPhabricatorConfigOptions.php', 'PhabricatorExtendingPhabricatorConfigOptions' => 'applications/config/option/PhabricatorExtendingPhabricatorConfigOptions.php',
@ -2225,7 +2226,7 @@ phutil_register_library_map(array(
1 => 'PhutilSafeHTMLProducerInterface', 1 => 'PhutilSafeHTMLProducerInterface',
), ),
'AphrontWebpageResponse' => 'AphrontHTMLResponse', 'AphrontWebpageResponse' => 'AphrontHTMLResponse',
'AuditPeopleMenuEventListener' => 'PhutilEventListener', 'AuditActionMenuEventListener' => 'PhabricatorEventListener',
'CelerityPhabricatorResourceController' => 'CelerityResourceController', 'CelerityPhabricatorResourceController' => 'CelerityResourceController',
'CelerityResourceController' => 'PhabricatorController', 'CelerityResourceController' => 'PhabricatorController',
'CelerityResourceGraph' => 'AbstractDirectedGraph', 'CelerityResourceGraph' => 'AbstractDirectedGraph',
@ -2375,13 +2376,14 @@ phutil_register_library_map(array(
'ConduitCallTestCase' => 'PhabricatorTestCase', 'ConduitCallTestCase' => 'PhabricatorTestCase',
'ConduitException' => 'Exception', 'ConduitException' => 'Exception',
'ConduitSSHWorkflow' => 'PhabricatorSSHWorkflow', 'ConduitSSHWorkflow' => 'PhabricatorSSHWorkflow',
'ConpherenceActionMenuEventListener' => 'PhabricatorEventListener',
'ConpherenceConfigOptions' => 'PhabricatorApplicationConfigOptions', 'ConpherenceConfigOptions' => 'PhabricatorApplicationConfigOptions',
'ConpherenceController' => 'PhabricatorController', 'ConpherenceController' => 'PhabricatorController',
'ConpherenceCreateThreadMailReceiver' => 'PhabricatorMailReceiver', 'ConpherenceCreateThreadMailReceiver' => 'PhabricatorMailReceiver',
'ConpherenceDAO' => 'PhabricatorLiskDAO', 'ConpherenceDAO' => 'PhabricatorLiskDAO',
'ConpherenceEditor' => 'PhabricatorApplicationTransactionEditor', 'ConpherenceEditor' => 'PhabricatorApplicationTransactionEditor',
'ConpherenceFileWidgetView' => 'ConpherenceWidgetView', 'ConpherenceFileWidgetView' => 'ConpherenceWidgetView',
'ConpherenceHovercardEventListener' => 'PhutilEventListener', 'ConpherenceHovercardEventListener' => 'PhabricatorEventListener',
'ConpherenceLayoutView' => 'AphrontView', 'ConpherenceLayoutView' => 'AphrontView',
'ConpherenceListController' => 'ConpherenceController', 'ConpherenceListController' => 'ConpherenceController',
'ConpherenceMenuItemView' => 'AphrontTagView', 'ConpherenceMenuItemView' => 'AphrontTagView',
@ -2391,7 +2393,6 @@ phutil_register_library_map(array(
'ConpherenceParticipantCountQuery' => 'PhabricatorOffsetPagedQuery', 'ConpherenceParticipantCountQuery' => 'PhabricatorOffsetPagedQuery',
'ConpherenceParticipantQuery' => 'PhabricatorOffsetPagedQuery', 'ConpherenceParticipantQuery' => 'PhabricatorOffsetPagedQuery',
'ConpherenceParticipationStatus' => 'ConpherenceConstants', 'ConpherenceParticipationStatus' => 'ConpherenceConstants',
'ConpherencePeopleMenuEventListener' => 'PhutilEventListener',
'ConpherencePeopleWidgetView' => 'ConpherenceWidgetView', 'ConpherencePeopleWidgetView' => 'ConpherenceWidgetView',
'ConpherenceReplyHandler' => 'PhabricatorMailReplyHandler', 'ConpherenceReplyHandler' => 'PhabricatorMailReplyHandler',
'ConpherenceSettings' => 'ConpherenceConstants', 'ConpherenceSettings' => 'ConpherenceConstants',
@ -2418,12 +2419,13 @@ phutil_register_library_map(array(
'DarkConsoleDataController' => 'PhabricatorController', 'DarkConsoleDataController' => 'PhabricatorController',
'DarkConsoleErrorLogPlugin' => 'DarkConsolePlugin', 'DarkConsoleErrorLogPlugin' => 'DarkConsolePlugin',
'DarkConsoleEventPlugin' => 'DarkConsolePlugin', 'DarkConsoleEventPlugin' => 'DarkConsolePlugin',
'DarkConsoleEventPluginAPI' => 'PhutilEventListener', 'DarkConsoleEventPluginAPI' => 'PhabricatorEventListener',
'DarkConsoleRequestPlugin' => 'DarkConsolePlugin', 'DarkConsoleRequestPlugin' => 'DarkConsolePlugin',
'DarkConsoleServicesPlugin' => 'DarkConsolePlugin', 'DarkConsoleServicesPlugin' => 'DarkConsolePlugin',
'DarkConsoleXHProfPlugin' => 'DarkConsolePlugin', 'DarkConsoleXHProfPlugin' => 'DarkConsolePlugin',
'DefaultDatabaseConfigurationProvider' => 'DatabaseConfigurationProvider', 'DefaultDatabaseConfigurationProvider' => 'DatabaseConfigurationProvider',
'DifferentialActionHasNoEffectException' => 'DifferentialException', 'DifferentialActionHasNoEffectException' => 'DifferentialException',
'DifferentialActionMenuEventListener' => 'PhabricatorEventListener',
'DifferentialAddCommentView' => 'AphrontView', 'DifferentialAddCommentView' => 'AphrontView',
'DifferentialAffectedPath' => 'DifferentialDAO', 'DifferentialAffectedPath' => 'DifferentialDAO',
'DifferentialApplyPatchFieldSpecification' => 'DifferentialFieldSpecification', 'DifferentialApplyPatchFieldSpecification' => 'DifferentialFieldSpecification',
@ -2496,7 +2498,7 @@ phutil_register_library_map(array(
'DifferentialFreeformFieldTestCase' => 'PhabricatorTestCase', 'DifferentialFreeformFieldTestCase' => 'PhabricatorTestCase',
'DifferentialGitSVNIDFieldSpecification' => 'DifferentialFieldSpecification', 'DifferentialGitSVNIDFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialHostFieldSpecification' => 'DifferentialFieldSpecification', 'DifferentialHostFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialHovercardEventListener' => 'PhutilEventListener', 'DifferentialHovercardEventListener' => 'PhabricatorEventListener',
'DifferentialHunk' => 'DifferentialDAO', 'DifferentialHunk' => 'DifferentialDAO',
'DifferentialHunkParserTestCase' => 'PhabricatorTestCase', 'DifferentialHunkParserTestCase' => 'PhabricatorTestCase',
'DifferentialHunkTestCase' => 'ArcanistPhutilTestCase', 'DifferentialHunkTestCase' => 'ArcanistPhutilTestCase',
@ -2516,7 +2518,6 @@ phutil_register_library_map(array(
'DifferentialPHIDTypeRevision' => 'PhabricatorPHIDType', 'DifferentialPHIDTypeRevision' => 'PhabricatorPHIDType',
'DifferentialParseRenderTestCase' => 'PhabricatorTestCase', 'DifferentialParseRenderTestCase' => 'PhabricatorTestCase',
'DifferentialPathFieldSpecification' => 'DifferentialFieldSpecification', 'DifferentialPathFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialPeopleMenuEventListener' => 'PhutilEventListener',
'DifferentialPrimaryPaneView' => 'AphrontView', 'DifferentialPrimaryPaneView' => 'AphrontView',
'DifferentialProjectReviewersFieldSpecification' => 'DifferentialFieldSpecification', 'DifferentialProjectReviewersFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialReleephRequestFieldSpecification' => 'DifferentialFieldSpecification', 'DifferentialReleephRequestFieldSpecification' => 'DifferentialFieldSpecification',
@ -2601,7 +2602,7 @@ phutil_register_library_map(array(
'DiffusionGitStableCommitNameQuery' => 'DiffusionStableCommitNameQuery', 'DiffusionGitStableCommitNameQuery' => 'DiffusionStableCommitNameQuery',
'DiffusionHistoryController' => 'DiffusionController', 'DiffusionHistoryController' => 'DiffusionController',
'DiffusionHistoryTableView' => 'DiffusionView', 'DiffusionHistoryTableView' => 'DiffusionView',
'DiffusionHovercardEventListener' => 'PhutilEventListener', 'DiffusionHovercardEventListener' => 'PhabricatorEventListener',
'DiffusionInlineCommentController' => 'PhabricatorInlineCommentController', 'DiffusionInlineCommentController' => 'PhabricatorInlineCommentController',
'DiffusionInlineCommentPreviewController' => 'PhabricatorInlineCommentPreviewController', 'DiffusionInlineCommentPreviewController' => 'PhabricatorInlineCommentPreviewController',
'DiffusionLastModifiedController' => 'DiffusionController', 'DiffusionLastModifiedController' => 'DiffusionController',
@ -2842,6 +2843,7 @@ phutil_register_library_map(array(
'LiskIsolationTestDAOException' => 'Exception', 'LiskIsolationTestDAOException' => 'Exception',
'LiskMigrationIterator' => 'PhutilBufferedIterator', 'LiskMigrationIterator' => 'PhutilBufferedIterator',
'LiskRawMigrationIterator' => 'PhutilBufferedIterator', 'LiskRawMigrationIterator' => 'PhutilBufferedIterator',
'ManiphestActionMenuEventListener' => 'PhabricatorEventListener',
'ManiphestBatchEditController' => 'ManiphestController', 'ManiphestBatchEditController' => 'ManiphestController',
'ManiphestCapabilityBulkEdit' => 'PhabricatorPolicyCapability', 'ManiphestCapabilityBulkEdit' => 'PhabricatorPolicyCapability',
'ManiphestCapabilityDefaultEdit' => 'PhabricatorPolicyCapability', 'ManiphestCapabilityDefaultEdit' => 'PhabricatorPolicyCapability',
@ -2863,14 +2865,13 @@ phutil_register_library_map(array(
'ManiphestCustomFieldStorage' => 'PhabricatorCustomFieldStorage', 'ManiphestCustomFieldStorage' => 'PhabricatorCustomFieldStorage',
'ManiphestCustomFieldStringIndex' => 'PhabricatorCustomFieldStringIndexStorage', 'ManiphestCustomFieldStringIndex' => 'PhabricatorCustomFieldStringIndexStorage',
'ManiphestDAO' => 'PhabricatorLiskDAO', 'ManiphestDAO' => 'PhabricatorLiskDAO',
'ManiphestEdgeEventListener' => 'PhutilEventListener', 'ManiphestEdgeEventListener' => 'PhabricatorEventListener',
'ManiphestExcelDefaultFormat' => 'ManiphestExcelFormat', 'ManiphestExcelDefaultFormat' => 'ManiphestExcelFormat',
'ManiphestExportController' => 'ManiphestController', 'ManiphestExportController' => 'ManiphestController',
'ManiphestHovercardEventListener' => 'PhutilEventListener', 'ManiphestHovercardEventListener' => 'PhabricatorEventListener',
'ManiphestNameIndex' => 'ManiphestDAO', 'ManiphestNameIndex' => 'ManiphestDAO',
'ManiphestNameIndexEventListener' => 'PhutilEventListener', 'ManiphestNameIndexEventListener' => 'PhabricatorEventListener',
'ManiphestPHIDTypeTask' => 'PhabricatorPHIDType', 'ManiphestPHIDTypeTask' => 'PhabricatorPHIDType',
'ManiphestPeopleMenuEventListener' => 'PhutilEventListener',
'ManiphestRemarkupRule' => 'PhabricatorRemarkupRuleObject', 'ManiphestRemarkupRule' => 'PhabricatorRemarkupRuleObject',
'ManiphestReplyHandler' => 'PhabricatorMailReplyHandler', 'ManiphestReplyHandler' => 'PhabricatorMailReplyHandler',
'ManiphestReportController' => 'ManiphestController', 'ManiphestReportController' => 'ManiphestController',
@ -3289,7 +3290,7 @@ phutil_register_library_map(array(
'PhabricatorDaemonConsoleController' => 'PhabricatorDaemonController', 'PhabricatorDaemonConsoleController' => 'PhabricatorDaemonController',
'PhabricatorDaemonController' => 'PhabricatorController', 'PhabricatorDaemonController' => 'PhabricatorController',
'PhabricatorDaemonDAO' => 'PhabricatorLiskDAO', 'PhabricatorDaemonDAO' => 'PhabricatorLiskDAO',
'PhabricatorDaemonEventListener' => 'PhutilEventListener', 'PhabricatorDaemonEventListener' => 'PhabricatorEventListener',
'PhabricatorDaemonLog' => 'PhabricatorDaemonLog' =>
array( array(
0 => 'PhabricatorDaemonDAO', 0 => 'PhabricatorDaemonDAO',
@ -3340,8 +3341,9 @@ phutil_register_library_map(array(
'PhabricatorEnvTestCase' => 'PhabricatorTestCase', 'PhabricatorEnvTestCase' => 'PhabricatorTestCase',
'PhabricatorErrorExample' => 'PhabricatorUIExample', 'PhabricatorErrorExample' => 'PhabricatorUIExample',
'PhabricatorEvent' => 'PhutilEvent', 'PhabricatorEvent' => 'PhutilEvent',
'PhabricatorEventListener' => 'PhutilEventListener',
'PhabricatorEventType' => 'PhutilEventType', 'PhabricatorEventType' => 'PhutilEventType',
'PhabricatorExampleEventListener' => 'PhutilEventListener', 'PhabricatorExampleEventListener' => 'PhabricatorEventListener',
'PhabricatorExtendingPhabricatorConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorExtendingPhabricatorConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorExternalAccount' => 'PhabricatorExternalAccount' =>
array( array(
@ -3464,7 +3466,7 @@ phutil_register_library_map(array(
'PhabricatorFlagQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorFlagQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorFlagSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhabricatorFlagSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorFlagSelectControl' => 'AphrontFormControl', 'PhabricatorFlagSelectControl' => 'AphrontFormControl',
'PhabricatorFlagsUIEventListener' => 'PhutilEventListener', 'PhabricatorFlagsUIEventListener' => 'PhabricatorEventListener',
'PhabricatorFormExample' => 'PhabricatorUIExample', 'PhabricatorFormExample' => 'PhabricatorUIExample',
'PhabricatorGarbageCollectorConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorGarbageCollectorConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorGarbageCollectorDaemon' => 'PhabricatorDaemon', 'PhabricatorGarbageCollectorDaemon' => 'PhabricatorDaemon',
@ -3670,7 +3672,7 @@ phutil_register_library_map(array(
'PhabricatorPasteViewController' => 'PhabricatorPasteController', 'PhabricatorPasteViewController' => 'PhabricatorPasteController',
'PhabricatorPeopleController' => 'PhabricatorController', 'PhabricatorPeopleController' => 'PhabricatorController',
'PhabricatorPeopleEditController' => 'PhabricatorPeopleController', 'PhabricatorPeopleEditController' => 'PhabricatorPeopleController',
'PhabricatorPeopleHovercardEventListener' => 'PhutilEventListener', 'PhabricatorPeopleHovercardEventListener' => 'PhabricatorEventListener',
'PhabricatorPeopleLdapController' => 'PhabricatorPeopleController', 'PhabricatorPeopleLdapController' => 'PhabricatorPeopleController',
'PhabricatorPeopleListController' => 'PhabricatorPeopleListController' =>
array( array(
@ -3947,7 +3949,7 @@ phutil_register_library_map(array(
'PhabricatorSubscribersQuery' => 'PhabricatorQuery', 'PhabricatorSubscribersQuery' => 'PhabricatorQuery',
'PhabricatorSubscriptionsEditController' => 'PhabricatorController', 'PhabricatorSubscriptionsEditController' => 'PhabricatorController',
'PhabricatorSubscriptionsEditor' => 'PhabricatorEditor', 'PhabricatorSubscriptionsEditor' => 'PhabricatorEditor',
'PhabricatorSubscriptionsUIEventListener' => 'PhutilEventListener', 'PhabricatorSubscriptionsUIEventListener' => 'PhabricatorEventListener',
'PhabricatorSymbolNameLinter' => 'ArcanistXHPASTLintNamingHook', 'PhabricatorSymbolNameLinter' => 'ArcanistXHPASTLintNamingHook',
'PhabricatorSyntaxHighlightingConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorSyntaxHighlightingConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorTagExample' => 'PhabricatorUIExample', 'PhabricatorTagExample' => 'PhabricatorUIExample',
@ -3984,7 +3986,7 @@ phutil_register_library_map(array(
'PhabricatorTokenPHIDTypeToken' => 'PhabricatorPHIDType', 'PhabricatorTokenPHIDTypeToken' => 'PhabricatorPHIDType',
'PhabricatorTokenQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorTokenQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorTokenReceiverQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorTokenReceiverQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorTokenUIEventListener' => 'PhutilEventListener', 'PhabricatorTokenUIEventListener' => 'PhabricatorEventListener',
'PhabricatorTransactionView' => 'AphrontView', 'PhabricatorTransactionView' => 'AphrontView',
'PhabricatorTransformedFile' => 'PhabricatorFileDAO', 'PhabricatorTransformedFile' => 'PhabricatorFileDAO',
'PhabricatorTranslationsConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorTranslationsConfigOptions' => 'PhabricatorApplicationConfigOptions',
@ -4237,7 +4239,7 @@ phutil_register_library_map(array(
'PhrequentTimeBlock' => 'Phobject', 'PhrequentTimeBlock' => 'Phobject',
'PhrequentTimeBlockTestCase' => 'PhabricatorTestCase', 'PhrequentTimeBlockTestCase' => 'PhabricatorTestCase',
'PhrequentTrackController' => 'PhrequentController', 'PhrequentTrackController' => 'PhrequentController',
'PhrequentUIEventListener' => 'PhutilEventListener', 'PhrequentUIEventListener' => 'PhabricatorEventListener',
'PhrequentUserTime' => 'PhrequentUserTime' =>
array( array(
0 => 'PhrequentDAO', 0 => 'PhrequentDAO',
@ -4245,7 +4247,7 @@ phutil_register_library_map(array(
), ),
'PhrequentUserTimeQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhrequentUserTimeQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhrictionActionConstants' => 'PhrictionConstants', 'PhrictionActionConstants' => 'PhrictionConstants',
'PhrictionActionMenuEventListener' => 'PhutilEventListener', 'PhrictionActionMenuEventListener' => 'PhabricatorEventListener',
'PhrictionChangeType' => 'PhrictionConstants', 'PhrictionChangeType' => 'PhrictionConstants',
'PhrictionContent' => 'PhrictionContent' =>
array( array(

View file

@ -3,7 +3,7 @@
/** /**
* @group console * @group console
*/ */
final class DarkConsoleEventPluginAPI extends PhutilEventListener { final class DarkConsoleEventPluginAPI extends PhabricatorEventListener {
private static $events = array(); private static $events = array();
private static $discardMode = false; private static $discardMode = false;

View file

@ -20,7 +20,7 @@ final class PhabricatorApplicationAudit extends PhabricatorApplication {
public function getEventListeners() { public function getEventListeners() {
return array( return array(
new AuditPeopleMenuEventListener() new AuditActionMenuEventListener()
); );
} }

View file

@ -1,6 +1,6 @@
<?php <?php
final class AuditPeopleMenuEventListener extends PhutilEventListener { final class AuditActionMenuEventListener extends PhabricatorEventListener {
public function register() { public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS); $this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);

View file

@ -31,7 +31,7 @@ final class PhabricatorApplicationConpherence extends PhabricatorApplication {
public function getEventListeners() { public function getEventListeners() {
return array( return array(
new ConpherencePeopleMenuEventListener(), new ConpherenceActionMenuEventListener(),
new ConpherenceHovercardEventListener(), new ConpherenceHovercardEventListener(),
); );
} }

View file

@ -1,6 +1,7 @@
<?php <?php
final class ConpherencePeopleMenuEventListener extends PhutilEventListener { final class ConpherenceActionMenuEventListener
extends PhabricatorEventListener {
public function register() { public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS); $this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);

View file

@ -8,7 +8,7 @@
* *
* @task event * @task event
*/ */
final class ConpherenceHovercardEventListener extends PhutilEventListener { final class ConpherenceHovercardEventListener extends PhabricatorEventListener {
public function register() { public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERHOVERCARD); $this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERHOVERCARD);

View file

@ -1,6 +1,6 @@
<?php <?php
final class PhabricatorDaemonEventListener extends PhutilEventListener { final class PhabricatorDaemonEventListener extends PhabricatorEventListener {
private $daemons = array(); private $daemons = array();

View file

@ -30,7 +30,7 @@ final class PhabricatorApplicationDifferential extends PhabricatorApplication {
public function getEventListeners() { public function getEventListeners() {
return array( return array(
new DifferentialPeopleMenuEventListener(), new DifferentialActionMenuEventListener(),
new DifferentialHovercardEventListener(), new DifferentialHovercardEventListener(),
); );
} }

View file

@ -1,6 +1,7 @@
<?php <?php
final class DifferentialPeopleMenuEventListener extends PhutilEventListener { final class DifferentialActionMenuEventListener
extends PhabricatorEventListener {
public function register() { public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS); $this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);

View file

@ -1,6 +1,7 @@
<?php <?php
final class DifferentialHovercardEventListener extends PhutilEventListener { final class DifferentialHovercardEventListener
extends PhabricatorEventListener {
public function register() { public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERHOVERCARD); $this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERHOVERCARD);

View file

@ -1,6 +1,6 @@
<?php <?php
final class DiffusionHovercardEventListener extends PhutilEventListener { final class DiffusionHovercardEventListener extends PhabricatorEventListener {
public function register() { public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERHOVERCARD); $this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERHOVERCARD);

View file

@ -1,6 +1,6 @@
<?php <?php
final class PhabricatorFlagsUIEventListener extends PhutilEventListener { final class PhabricatorFlagsUIEventListener extends PhabricatorEventListener {
public function register() { public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS); $this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);

View file

@ -35,7 +35,7 @@ final class PhabricatorApplicationManiphest extends PhabricatorApplication {
public function getEventListeners() { public function getEventListeners() {
return array( return array(
new ManiphestNameIndexEventListener(), new ManiphestNameIndexEventListener(),
new ManiphestPeopleMenuEventListener(), new ManiphestActionMenuEventListener(),
new ManiphestHovercardEventListener(), new ManiphestHovercardEventListener(),
); );
} }

View file

@ -1,6 +1,6 @@
<?php <?php
final class ManiphestPeopleMenuEventListener extends PhutilEventListener { final class ManiphestActionMenuEventListener extends PhabricatorEventListener {
public function register() { public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS); $this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);

View file

@ -7,7 +7,7 @@
* *
* @group maniphest * @group maniphest
*/ */
final class ManiphestEdgeEventListener extends PhutilEventListener { final class ManiphestEdgeEventListener extends PhabricatorEventListener {
private $edges = array(); private $edges = array();
private $tasks = array(); private $tasks = array();

View file

@ -1,6 +1,6 @@
<?php <?php
final class ManiphestHovercardEventListener extends PhutilEventListener { final class ManiphestHovercardEventListener extends PhabricatorEventListener {
public function register() { public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERHOVERCARD); $this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERHOVERCARD);

View file

@ -1,6 +1,6 @@
<?php <?php
final class ManiphestNameIndexEventListener extends PhutilEventListener { final class ManiphestNameIndexEventListener extends PhabricatorEventListener {
public function register() { public function register() {
$this->listen(PhabricatorEventType::TYPE_SEARCH_DIDUPDATEINDEX); $this->listen(PhabricatorEventType::TYPE_SEARCH_DIDUPDATEINDEX);

View file

@ -1,7 +1,7 @@
<?php <?php
final class PhabricatorPeopleHovercardEventListener final class PhabricatorPeopleHovercardEventListener
extends PhutilEventListener { extends PhabricatorEventListener {
public function register() { public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERHOVERCARD); $this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERHOVERCARD);

View file

@ -1,7 +1,7 @@
<?php <?php
final class PhrequentUIEventListener final class PhrequentUIEventListener
extends PhutilEventListener { extends PhabricatorEventListener {
public function register() { public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS); $this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);

View file

@ -1,6 +1,6 @@
<?php <?php
final class PhrictionActionMenuEventListener extends PhutilEventListener { final class PhrictionActionMenuEventListener extends PhabricatorEventListener {
public function register() { public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS); $this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);

View file

@ -1,7 +1,7 @@
<?php <?php
final class PhabricatorSubscriptionsUIEventListener final class PhabricatorSubscriptionsUIEventListener
extends PhutilEventListener { extends PhabricatorEventListener {
public function register() { public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS); $this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);

View file

@ -1,7 +1,7 @@
<?php <?php
final class PhabricatorTokenUIEventListener final class PhabricatorTokenUIEventListener
extends PhutilEventListener { extends PhabricatorEventListener {
public function register() { public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS); $this->listen(PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS);

View file

@ -26,6 +26,7 @@ final class PhabricatorEventEngine {
foreach ($applications as $application) { foreach ($applications as $application) {
$listeners = $application->getEventListeners(); $listeners = $application->getEventListeners();
foreach ($listeners as $listener) { foreach ($listeners as $listener) {
$listener->setApplication($application);
$listener->register(); $listener->register();
} }
} }

View file

@ -0,0 +1,36 @@
<?php
abstract class PhabricatorEventListener extends PhutilEventListener {
private $application;
public function setApplication(PhabricatorApplication $application) {
$this->application = $application;
return $this;
}
public function getApplication() {
return $this->application;
}
public function hasApplicationCapability(
PhabricatorUser $viewer,
$capability) {
return PhabricatorPolicyFilter::hasCapability(
$viewer,
$this->getApplication(),
$capability);
}
public function canUseApplication(PhabricatorUser $viewer) {
return $this->hasApplicationCapability(
$viewer,
PhabricatorPolicyCapability::CAN_VIEW);
}
}

View file

@ -6,7 +6,7 @@
* *
* @group events * @group events
*/ */
final class PhabricatorExampleEventListener extends PhutilEventListener { final class PhabricatorExampleEventListener extends PhabricatorEventListener {
public function register() { public function register() {
// When your listener is installed, its register() method will be called. // When your listener is installed, its register() method will be called.