Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14012168
D11653.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D11653.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 2, 7:46 AM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6714974
Default Alt Text
D11653.diff (2 KB)
Attached To
Mode
D11653: Policy - do proper policy queries when updating owners packages in commit workers
Attached
Detach File
Event Timeline
Log In to Comment