Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14623442
D21815.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D21815.diff
View Options
diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php
--- a/src/applications/files/storage/PhabricatorFile.php
+++ b/src/applications/files/storage/PhabricatorFile.php
@@ -1426,23 +1426,6 @@
}
- /**
- * Remove the policy edge between this file and some object.
- *
- * @param phid Object PHID to detach from.
- * @return this
- */
- public function detachFromObject($phid) {
- $edge_type = PhabricatorObjectHasFileEdgeType::EDGECONST;
-
- id(new PhabricatorEdgeEditor())
- ->removeEdge($phid, $edge_type, $this->getPHID())
- ->save();
-
- return $this;
- }
-
-
/**
* Configure a newly created file object according to specified parameters.
*
diff --git a/src/applications/files/storage/__tests__/PhabricatorFileTestCase.php b/src/applications/files/storage/__tests__/PhabricatorFileTestCase.php
--- a/src/applications/files/storage/__tests__/PhabricatorFileTestCase.php
+++ b/src/applications/files/storage/__tests__/PhabricatorFileTestCase.php
@@ -224,18 +224,6 @@
),
$this->canViewFile($users, $xform),
pht('Attached Thumbnail Visibility'));
-
- // Detach the object and make sure it affects the thumbnail.
- $file->detachFromObject($object->getPHID());
-
- // Test the detached thumbnail's visibility.
- $this->assertEqual(
- array(
- true,
- false,
- ),
- $this->canViewFile($users, $xform),
- pht('Detached Thumbnail Visibility'));
}
private function canViewFile(array $users, PhabricatorFile $file) {
diff --git a/src/applications/macro/xaction/PhabricatorMacroAudioTransaction.php b/src/applications/macro/xaction/PhabricatorMacroAudioTransaction.php
--- a/src/applications/macro/xaction/PhabricatorMacroAudioTransaction.php
+++ b/src/applications/macro/xaction/PhabricatorMacroAudioTransaction.php
@@ -13,32 +13,14 @@
$object->setAudioPHID($value);
}
- public function applyExternalEffects($object, $value) {
- $old = $this->generateOldValue($object);
- $new = $value;
- $all = array();
- if ($old) {
- $all[] = $old;
- }
- if ($new) {
- $all[] = $new;
- }
+ public function extractFilePHIDs($object, $value) {
+ $file_phids = array();
- $files = id(new PhabricatorFileQuery())
- ->setViewer($this->getActor())
- ->withPHIDs($all)
- ->execute();
- $files = mpull($files, null, 'getPHID');
-
- $old_file = idx($files, $old);
- if ($old_file) {
- $old_file->detachFromObject($object->getPHID());
+ if ($value) {
+ $file_phids[] = $value;
}
- $new_file = idx($files, $new);
- if ($new_file) {
- $new_file->attachToObject($object->getPHID());
- }
+ return $file_phids;
}
public function getTitle() {
diff --git a/src/applications/macro/xaction/PhabricatorMacroFileTransaction.php b/src/applications/macro/xaction/PhabricatorMacroFileTransaction.php
--- a/src/applications/macro/xaction/PhabricatorMacroFileTransaction.php
+++ b/src/applications/macro/xaction/PhabricatorMacroFileTransaction.php
@@ -13,32 +13,8 @@
$object->setFilePHID($value);
}
- public function applyExternalEffects($object, $value) {
- $old = $this->generateOldValue($object);
- $new = $value;
- $all = array();
- if ($old) {
- $all[] = $old;
- }
- if ($new) {
- $all[] = $new;
- }
-
- $files = id(new PhabricatorFileQuery())
- ->setViewer($this->getActor())
- ->withPHIDs($all)
- ->execute();
- $files = mpull($files, null, 'getPHID');
-
- $old_file = idx($files, $old);
- if ($old_file) {
- $old_file->detachFromObject($object->getPHID());
- }
-
- $new_file = idx($files, $new);
- if ($new_file) {
- $new_file->attachToObject($object->getPHID());
- }
+ public function extractFilePHIDs($object, $value) {
+ return array($value);
}
public function getTitle() {
diff --git a/src/applications/project/xaction/PhabricatorProjectImageTransaction.php b/src/applications/project/xaction/PhabricatorProjectImageTransaction.php
--- a/src/applications/project/xaction/PhabricatorProjectImageTransaction.php
+++ b/src/applications/project/xaction/PhabricatorProjectImageTransaction.php
@@ -13,34 +13,6 @@
$object->setProfileImagePHID($value);
}
- public function applyExternalEffects($object, $value) {
- $old = $this->getOldValue();
- $new = $value;
- $all = array();
- if ($old) {
- $all[] = $old;
- }
- if ($new) {
- $all[] = $new;
- }
-
- $files = id(new PhabricatorFileQuery())
- ->setViewer($this->getActor())
- ->withPHIDs($all)
- ->execute();
- $files = mpull($files, null, 'getPHID');
-
- $old_file = idx($files, $old);
- if ($old_file) {
- $old_file->detachFromObject($object->getPHID());
- }
-
- $new_file = idx($files, $new);
- if ($new_file) {
- $new_file->attachToObject($object->getPHID());
- }
- }
-
public function getTitle() {
$old = $this->getOldValue();
$new = $this->getNewValue();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 11, 1:17 PM (15 h, 27 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6985115
Default Alt Text
D21815.diff (4 KB)
Attached To
Mode
D21815: Remove "PhabricatorFile->detachFromObject()"
Attached
Detach File
Event Timeline
Log In to Comment