Page MenuHomePhabricator

D11653.id.diff
No OneTemporary

D11653.id.diff

diff --git a/src/applications/repository/worker/commitchangeparser/PhabricatorOwnersPackagePathValidator.php b/src/applications/repository/worker/commitchangeparser/PhabricatorOwnersPackagePathValidator.php
--- a/src/applications/repository/worker/commitchangeparser/PhabricatorOwnersPackagePathValidator.php
+++ b/src/applications/repository/worker/commitchangeparser/PhabricatorOwnersPackagePathValidator.php
@@ -8,16 +8,25 @@
* paths.
*/
public static function updateOwnersPackagePaths(
- PhabricatorRepositoryCommit $commit) {
- $changes = self::loadDiffusionChangesForCommit($commit);
+ PhabricatorRepositoryCommit $commit,
+ PhabricatorUser $actor) {
+
+ $repository = id(new PhabricatorRepositoryQuery())
+ ->setViewer($actor)
+ ->withIDs(array($commit->getRepositoryID()))
+ ->executeOne();
+ if (!$repository) {
+ return;
+ }
+ $changes = self::loadDiffusionChangesForCommit(
+ $repository,
+ $commit,
+ $actor);
if (!$changes) {
return;
}
- // TODO: (T603) This should be policy-aware.
- $repository =
- id(new PhabricatorRepository())->load($commit->getRepositoryID());
$move_map = array();
foreach ($changes as $change) {
if ($change->getChangeType() == DifferentialChangeType::TYPE_MOVE_HERE) {
@@ -82,11 +91,12 @@
}
}
- private static function loadDiffusionChangesForCommit($commit) {
- $repository =
- id(new PhabricatorRepository())->load($commit->getRepositoryID());
+ private static function loadDiffusionChangesForCommit(
+ PhabricatorRepository $repository,
+ PhabricatorRepositoryCommit $commit,
+ PhabricatorUser $actor) {
$data = array(
- 'user' => PhabricatorUser::getOmnipotentUser(),
+ 'user' => $actor,
'repository' => $repository,
'commit' => $commit->getCommitIdentifier(),
);
diff --git a/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryCommitChangeParserWorker.php b/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryCommitChangeParserWorker.php
--- a/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryCommitChangeParserWorker.php
+++ b/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryCommitChangeParserWorker.php
@@ -96,7 +96,9 @@
id(new PhabricatorSearchIndexer())
->queueDocumentForIndexing($commit->getPHID());
- PhabricatorOwnersPackagePathValidator::updateOwnersPackagePaths($commit);
+ PhabricatorOwnersPackagePathValidator::updateOwnersPackagePaths(
+ $commit,
+ PhabricatorUser::getOmnipotentUser());
if ($this->shouldQueueFollowupTasks()) {
$this->queueTask(
'PhabricatorRepositoryCommitOwnersWorker',

File Metadata

Mime Type
text/plain
Expires
Thu, Oct 17, 8:36 AM (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6714974
Default Alt Text
D11653.id.diff (2 KB)

Event Timeline