mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-19 03:01:11 +01:00
Don't require an actor in PhabricatorFile::attachToObject()
Summary: Ref T6013. A very long time ago, edges were less clearly low-level infrastructure, and some user-aware stuff got built around edge edits. This was kind of a mess and I eventually removed it, during or prior to T5245. The big issue was that control flow was really hard to figure out as things went all the way down to the deepest level of infrastructure and then came back up the stack to events and transactions. The new stuff is more top-down and generally seems a lot easier and cleaner. Consequently, actors are no longer required for edge edits. Remove the parameter. Test Plan: Poked around; ran unit tests. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley, hach-que Maniphest Tasks: T6013 Differential Revision: https://secure.phabricator.com/D10412
This commit is contained in:
parent
8038af4bd5
commit
3af442e4ac
10 changed files with 9 additions and 15 deletions
|
@ -913,9 +913,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
|
|||
));
|
||||
|
||||
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
|
||||
$file->attachToObject(
|
||||
$this->getRequest()->getUser(),
|
||||
$revision->getPHID());
|
||||
$file->attachToObject($revision->getPHID());
|
||||
unset($unguarded);
|
||||
|
||||
return $file->getRedirectResponse();
|
||||
|
|
|
@ -881,7 +881,6 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController {
|
|||
|
||||
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
|
||||
$file->attachToObject(
|
||||
$this->getRequest()->getUser(),
|
||||
$this->getDiffusionRequest()->getRepository()->getPHID());
|
||||
unset($unguarded);
|
||||
|
||||
|
|
|
@ -1037,9 +1037,7 @@ final class DiffusionCommitController extends DiffusionController {
|
|||
));
|
||||
|
||||
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
|
||||
$file->attachToObject(
|
||||
$this->getRequest()->getUser(),
|
||||
$drequest->getRepository()->getPHID());
|
||||
$file->attachToObject($drequest->getRepository()->getPHID());
|
||||
unset($unguarded);
|
||||
|
||||
return $file->getRedirectResponse();
|
||||
|
|
|
@ -944,11 +944,10 @@ final class PhabricatorFile extends PhabricatorFileDAO
|
|||
/**
|
||||
* Write the policy edge between this file and some object.
|
||||
*
|
||||
* @param PhabricatorUser Acting user.
|
||||
* @param phid Object PHID to attach to.
|
||||
* @return this
|
||||
*/
|
||||
public function attachToObject(PhabricatorUser $actor, $phid) {
|
||||
public function attachToObject($phid) {
|
||||
$edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_FILE;
|
||||
|
||||
id(new PhabricatorEdgeEditor())
|
||||
|
|
|
@ -60,7 +60,7 @@ final class PhabricatorFileTestCase extends PhabricatorTestCase {
|
|||
// Attach the file to the object and test that the association opens a
|
||||
// policy exception for the non-author viewer.
|
||||
|
||||
$file->attachToObject($author, $object->getPHID());
|
||||
$file->attachToObject($object->getPHID());
|
||||
|
||||
// Test the attached file's visibility.
|
||||
$this->assertEqual(
|
||||
|
|
|
@ -111,7 +111,7 @@ final class PhabricatorMacroEditor
|
|||
|
||||
$new_file = idx($files, $new);
|
||||
if ($new_file) {
|
||||
$new_file->attachToObject($this->requireActor(), $object->getPHID());
|
||||
$new_file->attachToObject($object->getPHID());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ final class PhabricatorPeopleProfilePictureController
|
|||
$user->setProfileImagePHID(null);
|
||||
} else {
|
||||
$user->setProfileImagePHID($xformed->getPHID());
|
||||
$xformed->attachToObject($viewer, $user->getPHID());
|
||||
$xformed->attachToObject($user->getPHID());
|
||||
}
|
||||
$user->save();
|
||||
return id(new AphrontRedirectResponse())->setURI($profile_uri);
|
||||
|
|
|
@ -94,7 +94,7 @@ final class PhragmentPatchController extends PhragmentController {
|
|||
));
|
||||
|
||||
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
|
||||
$result->attachToObject($viewer, $version_b->getFragmentPHID());
|
||||
$result->attachToObject($version_b->getFragmentPHID());
|
||||
unset($unguarded);
|
||||
|
||||
return id(new AphrontRedirectResponse())
|
||||
|
|
|
@ -114,7 +114,7 @@ final class PhragmentZIPController extends PhragmentController {
|
|||
));
|
||||
|
||||
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
|
||||
$file->attachToObject($viewer, $fragment->getPHID());
|
||||
$file->attachToObject($fragment->getPHID());
|
||||
unset($unguarded);
|
||||
|
||||
$return = $fragment->getURI();
|
||||
|
|
|
@ -119,7 +119,7 @@ final class PhragmentFragment extends PhragmentDAO
|
|||
$this->save();
|
||||
$this->saveTransaction();
|
||||
|
||||
$file->attachToObject($viewer, $version->getPHID());
|
||||
$file->attachToObject($version->getPHID());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue