1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Add getQueryApplicationClass() to *TransactionQuery.php classes

Summary:
Add `getQueryApplicationClass()` to all `*TransactionQuery.php` classes similar to other `*Query.php` classes having the same function, and make the parent function in `PhabricatorApplicationTransactionQuery.php` abstract.

In the future, this will enable excluding transaction query results based on their underlying application (for example if an application has been uninstalled) to mitigate the problem of overheated search results. See https://we.phorge.it/T15642 for context.

The only callers of `getQueryApplicationClass()` are in `src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php` and `src/applications/policy/__tests__/PhabricatorPolicyTestCase.php`.

See T15642

Test Plan:
Patch changes only one existing code place, thus check if related pages still work as expected:
* Go to http://phorge.localhost/feed/
* Go to http://phorge.localhost/feed/transactions/
* On http://phorge.localhost/feed/transactions/ , click `Edit Query` and set `Object Types` to `Application` etc.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15642

Differential Revision: https://we.phorge.it/D25500
This commit is contained in:
Andre Klapper 2023-12-25 21:28:39 +01:00
parent 87db482897
commit 064424c1b7
80 changed files with 326 additions and 1 deletions

View file

@ -7,4 +7,8 @@ final class AlmanacBindingTransactionQuery
return new AlmanacBindingTransaction(); return new AlmanacBindingTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorAlmanacApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class AlmanacDeviceTransactionQuery
return new AlmanacDeviceTransaction(); return new AlmanacDeviceTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorAlmanacApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class AlmanacInterfaceTransactionQuery
return new AlmanacInterfaceTransaction(); return new AlmanacInterfaceTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorAlmanacApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class AlmanacNamespaceTransactionQuery
return new AlmanacNamespaceTransaction(); return new AlmanacNamespaceTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorAlmanacApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class AlmanacNetworkTransactionQuery
return new AlmanacNetworkTransaction(); return new AlmanacNetworkTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorAlmanacApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class AlmanacServiceTransactionQuery
return new AlmanacServiceTransaction(); return new AlmanacServiceTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorAlmanacApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorAuditTransactionQuery
return new PhabricatorAuditTransaction(); return new PhabricatorAuditTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorAuditApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorAuthContactNumberTransactionQuery
return new PhabricatorAuthContactNumberTransaction(); return new PhabricatorAuthContactNumberTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorAuthApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorAuthFactorProviderTransactionQuery
return new PhabricatorAuthFactorProviderTransaction(); return new PhabricatorAuthFactorProviderTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorAuthApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorAuthMessageTransactionQuery
return new PhabricatorAuthMessageTransaction(); return new PhabricatorAuthMessageTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorAuthApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorAuthPasswordTransactionQuery
return new PhabricatorAuthPasswordTransaction(); return new PhabricatorAuthPasswordTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorAuthApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorAuthProviderConfigTransactionQuery
return new PhabricatorAuthProviderConfigTransaction(); return new PhabricatorAuthProviderConfigTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorAuthApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorAuthSSHKeyTransactionQuery
return new PhabricatorAuthSSHKeyTransaction(); return new PhabricatorAuthSSHKeyTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorAuthApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorBadgesTransactionQuery
return new PhabricatorBadgesTransaction(); return new PhabricatorBadgesTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorBadgesApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorCalendarEventTransactionQuery
return new PhabricatorCalendarEventTransaction(); return new PhabricatorCalendarEventTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorCalendarApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorCalendarExportTransactionQuery
return new PhabricatorCalendarExportTransaction(); return new PhabricatorCalendarExportTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorCalendarApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorCalendarImportTransactionQuery
return new PhabricatorCalendarImportTransaction(); return new PhabricatorCalendarImportTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorCalendarApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorConfigTransactionQuery
return new PhabricatorConfigTransaction(); return new PhabricatorConfigTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorConfigApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class ConpherenceTransactionQuery
return new ConpherenceTransaction(); return new ConpherenceTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorConpherenceApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorCountdownTransactionQuery
return new PhabricatorCountdownTransaction(); return new PhabricatorCountdownTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorCountdownApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorDashboardPanelTransactionQuery
return new PhabricatorDashboardPanelTransaction(); return new PhabricatorDashboardPanelTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorDashboardApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorDashboardPortalTransactionQuery
return new PhabricatorDashboardPortalTransaction(); return new PhabricatorDashboardPortalTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorDashboardApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorDashboardTransactionQuery
return new PhabricatorDashboardTransaction(); return new PhabricatorDashboardTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorDashboardApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class DifferentialDiffTransactionQuery
return new DifferentialDiffTransaction(); return new DifferentialDiffTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorDifferentialApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class DifferentialTransactionQuery
return new DifferentialTransaction(); return new DifferentialTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorDifferentialApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class DivinerLiveBookTransactionQuery
return new DivinerLiveBookTransaction(); return new DivinerLiveBookTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorDivinerApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class DrydockBlueprintTransactionQuery
return new DrydockBlueprintTransaction(); return new DrydockBlueprintTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorDrydockApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorFileTransactionQuery
return new PhabricatorFileTransaction(); return new PhabricatorFileTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorFilesApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class FundBackerTransactionQuery
return new FundBackerTransaction(); return new FundBackerTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorFundApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class FundInitiativeTransactionQuery
return new FundInitiativeTransaction(); return new FundInitiativeTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorFundApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class HarbormasterBuildPlanTransactionQuery
return new HarbormasterBuildPlanTransaction(); return new HarbormasterBuildPlanTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorHarbormasterApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class HarbormasterBuildStepTransactionQuery
return new HarbormasterBuildStepTransaction(); return new HarbormasterBuildStepTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorHarbormasterApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class HarbormasterBuildTransactionQuery
return new HarbormasterBuildTransaction(); return new HarbormasterBuildTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorHarbormasterApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class HarbormasterBuildableTransactionQuery
return new HarbormasterBuildableTransaction(); return new HarbormasterBuildableTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorHarbormasterApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class HeraldTransactionQuery
return new HeraldRuleTransaction(); return new HeraldRuleTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorHeraldApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class HeraldWebhookTransactionQuery
return new HeraldWebhookTransaction(); return new HeraldWebhookTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorHeraldApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class LegalpadTransactionQuery
return new LegalpadTransaction(); return new LegalpadTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorLegalpadApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorMacroTransactionQuery
return new PhabricatorMacroTransaction(); return new PhabricatorMacroTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorMacroApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class ManiphestTransactionQuery
return new ManiphestTransaction(); return new ManiphestTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorManiphestApplication::class;
}
} }

View file

@ -7,4 +7,11 @@ final class PhabricatorApplicationApplicationTransactionQuery
return new PhabricatorApplicationApplicationTransaction(); return new PhabricatorApplicationApplicationTransaction();
} }
// NOTE: Although this belongs to the "Applications" application, trying
// to filter its results just leaves us recursing indefinitely. Users
// always have access to applications regardless of other policy settings
// anyway.
public function getQueryApplicationClass() {
return null;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorMetaMTAApplicationEmailTransactionQuery
return new PhabricatorMetaMTAApplicationEmailTransaction(); return new PhabricatorMetaMTAApplicationEmailTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorMetaMTAApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class NuanceItemTransactionQuery
return new NuanceItemTransaction(); return new NuanceItemTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorNuanceApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class NuanceQueueTransactionQuery
return new NuanceQueueTransaction(); return new NuanceQueueTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorNuanceApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class NuanceSourceTransactionQuery
return new NuanceSourceTransaction(); return new NuanceSourceTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorNuanceApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorOAuthServerTransactionQuery
return new PhabricatorOAuthServerTransaction(); return new PhabricatorOAuthServerTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorOAuthServerApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorOwnersPackageTransactionQuery
return new PhabricatorOwnersPackageTransaction(); return new PhabricatorOwnersPackageTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorOwnersApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorPackagesPackageTransactionQuery
return new PhabricatorPackagesPackageTransaction(); return new PhabricatorPackagesPackageTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPackagesApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorPackagesPublisherTransactionQuery
return new PhabricatorPackagesPublisherTransaction(); return new PhabricatorPackagesPublisherTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPackagesApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorPackagesVersionTransactionQuery
return new PhabricatorPackagesVersionTransaction(); return new PhabricatorPackagesVersionTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPackagesApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PassphraseCredentialTransactionQuery
return new PassphraseCredentialTransaction(); return new PassphraseCredentialTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPassphraseApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorPasteTransactionQuery
return new PhabricatorPasteTransaction(); return new PhabricatorPasteTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPasteApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorPeopleTransactionQuery
return new PhabricatorUserTransaction(); return new PhabricatorUserTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPeopleApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhameBlogTransactionQuery
return new PhameBlogTransaction(); return new PhameBlogTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPhameApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhamePostTransactionQuery
return new PhamePostTransaction(); return new PhamePostTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPhameApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhluxTransactionQuery
return new PhluxTransaction(); return new PhluxTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPhluxApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PholioTransactionQuery
return new PholioTransaction(); return new PholioTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPholioApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhortuneAccountEmailTransactionQuery
return new PhortuneAccountEmailTransaction(); return new PhortuneAccountEmailTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPhortuneApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhortuneAccountTransactionQuery
return new PhortuneAccountTransaction(); return new PhortuneAccountTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPhortuneApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhortuneCartTransactionQuery
return new PhortuneCartTransaction(); return new PhortuneCartTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPhortuneApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhortuneMerchantTransactionQuery
return new PhortuneMerchantTransaction(); return new PhortuneMerchantTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPhortuneApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhortunePaymentMethodTransactionQuery
return new PhortunePaymentMethodTransaction(); return new PhortunePaymentMethodTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPhortuneApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhortunePaymentProviderConfigTransactionQuery
return new PhortunePaymentProviderConfigTransaction(); return new PhortunePaymentProviderConfigTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPhortuneApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhortuneSubscriptionTransactionQuery
return new PhortuneSubscriptionTransaction(); return new PhortuneSubscriptionTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPhortuneApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhrictionTransactionQuery
return new PhrictionTransaction(); return new PhrictionTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPhrictionApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorPhurlURLTransactionQuery
return new PhabricatorPhurlURLTransaction(); return new PhabricatorPhurlURLTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPhurlApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PonderAnswerTransactionQuery
return new PonderAnswerTransaction(); return new PonderAnswerTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPonderApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PonderQuestionTransactionQuery
return new PonderQuestionTransaction(); return new PonderQuestionTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorPonderApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorProjectColumnTransactionQuery
return new PhabricatorProjectColumnTransaction(); return new PhabricatorProjectColumnTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorProjectApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorProjectTransactionQuery
return new PhabricatorProjectTransaction(); return new PhabricatorProjectTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorProjectApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorProjectTriggerTransactionQuery
return new PhabricatorProjectTriggerTransaction(); return new PhabricatorProjectTriggerTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorProjectApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorRepositoryIdentityTransactionQuery
return new PhabricatorRepositoryIdentityTransaction(); return new PhabricatorRepositoryIdentityTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorDiffusionApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorRepositoryTransactionQuery
return new PhabricatorRepositoryTransaction(); return new PhabricatorRepositoryTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorDiffusionApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorRepositoryURITransactionQuery
return new PhabricatorRepositoryURITransaction(); return new PhabricatorRepositoryURITransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorDiffusionApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorProfileMenuItemConfigurationTransactionQuery
return new PhabricatorProfileMenuItemConfigurationTransaction(); return new PhabricatorProfileMenuItemConfigurationTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorSearchApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorUserPreferencesTransactionQuery
return new PhabricatorUserPreferencesTransaction(); return new PhabricatorUserPreferencesTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorSettingsApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorSlowvoteTransactionQuery
return new PhabricatorSlowvoteTransaction(); return new PhabricatorSlowvoteTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorSlowvoteApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorSpacesNamespaceTransactionQuery
return new PhabricatorSpacesNamespaceTransaction(); return new PhabricatorSpacesNamespaceTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorSpacesApplication::class;
}
} }

View file

@ -292,8 +292,14 @@ abstract class PhabricatorApplicationTransactionQuery
return parent::shouldGroupQueryResultRows(); return parent::shouldGroupQueryResultRows();
} }
/**
* Get name of class of application queried by the query.
*
* To be overwritten by child classes when applicable.
*
* @return string|null Application class name
*/
public function getQueryApplicationClass() { public function getQueryApplicationClass() {
// TODO: Sort this out?
return null; return null;
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorEditEngineConfigurationTransactionQuery
return new PhabricatorEditEngineConfigurationTransaction(); return new PhabricatorEditEngineConfigurationTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorTransactionsApplication::class;
}
} }

View file

@ -7,4 +7,8 @@ final class PhabricatorWorkerBulkJobTransactionQuery
return new PhabricatorWorkerBulkJobTransaction(); return new PhabricatorWorkerBulkJobTransaction();
} }
public function getQueryApplicationClass() {
return PhabricatorDaemonsApplication::class;
}
} }