Page MenuHomePhabricator

D16567.id39878.diff
No OneTemporary

D16567.id39878.diff

diff --git a/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php b/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php
--- a/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php
+++ b/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php
@@ -112,25 +112,6 @@
}
}
- public function testAddMessageWithFileAttachments() {
- $creator = $this->generateNewTestUser();
- $friend_1 = $this->generateNewTestUser();
-
- $participant_map = array(
- $creator->getPHID() => $creator,
- $friend_1->getPHID() => $friend_1,
- );
-
- $conpherence = $this->createRoom(
- $creator,
- array_keys($participant_map));
-
- foreach ($participant_map as $phid => $user) {
- $xactions = $this->addMessageWithFile($user, $conpherence);
- $this->assertEqual(2, count($xactions));
- }
- }
-
private function createRoom(
PhabricatorUser $creator,
array $participant_phids) {
diff --git a/src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php b/src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php
--- a/src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php
+++ b/src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php
@@ -37,8 +37,7 @@
$query = id(new ConpherenceThreadQuery())
->setViewer($user)
- ->needParticipantCache(true)
- ->needFilePHIDs(true);
+ ->needParticipantCache(true);
if ($ids) {
$conpherences = $query
@@ -73,7 +72,6 @@
'conpherenceTitle' => $conpherence->getTitle(),
'messageCount' => $conpherence->getMessageCount(),
'recentParticipantPHIDs' => $conpherence->getRecentParticipantPHIDs(),
- 'filePHIDs' => $conpherence->getFilePHIDs(),
'conpherenceURI' => $this->getConpherenceURI($conpherence),
);
}
diff --git a/src/applications/conpherence/conduit/ConpherenceUpdateThreadConduitAPIMethod.php b/src/applications/conpherence/conduit/ConpherenceUpdateThreadConduitAPIMethod.php
--- a/src/applications/conpherence/conduit/ConpherenceUpdateThreadConduitAPIMethod.php
+++ b/src/applications/conpherence/conduit/ConpherenceUpdateThreadConduitAPIMethod.php
@@ -44,8 +44,7 @@
$id = $request->getValue('id');
$phid = $request->getValue('phid');
$query = id(new ConpherenceThreadQuery())
- ->setViewer($user)
- ->needFilePHIDs(true);
+ ->setViewer($user);
if ($id) {
$query->withIDs(array($id));
} else if ($phid) {
diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php
--- a/src/applications/conpherence/controller/ConpherenceUpdateController.php
+++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php
@@ -36,7 +36,6 @@
$conpherence = id(new ConpherenceThreadQuery())
->setViewer($user)
->withIDs(array($conpherence_id))
- ->needFilePHIDs(true)
->needOrigPics(true)
->needCropPics(true)
->needParticipants($need_participants)
diff --git a/src/applications/conpherence/editor/ConpherenceEditor.php b/src/applications/conpherence/editor/ConpherenceEditor.php
--- a/src/applications/conpherence/editor/ConpherenceEditor.php
+++ b/src/applications/conpherence/editor/ConpherenceEditor.php
@@ -22,7 +22,6 @@
$topic) {
$conpherence = ConpherenceThread::initializeNewRoom($creator);
- $files = array();
$errors = array();
if (empty($participant_phids)) {
$errors[] = self::ERROR_EMPTY_PARTICIPANTS;
@@ -35,26 +34,11 @@
$errors[] = self::ERROR_EMPTY_MESSAGE;
}
- $file_phids = PhabricatorMarkupEngine::extractFilePHIDsFromEmbeddedFiles(
- $creator,
- array($message));
- if ($file_phids) {
- $files = id(new PhabricatorFileQuery())
- ->setViewer($creator)
- ->withPHIDs($file_phids)
- ->execute();
- }
-
if (!$errors) {
$xactions = array();
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS)
->setNewValue(array('+' => $participant_phids));
- if ($files) {
- $xactions[] = id(new ConpherenceTransaction())
- ->setTransactionType(ConpherenceTransaction::TYPE_FILES)
- ->setNewValue(array('+' => mpull($files, 'getPHID')));
- }
if ($title) {
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
@@ -88,27 +72,7 @@
ConpherenceThread $conpherence,
$text) {
- $files = array();
- $file_phids = PhabricatorMarkupEngine::extractFilePHIDsFromEmbeddedFiles(
- $viewer,
- array($text));
- // Since these are extracted from text, we might be re-including the
- // same file -- e.g. a mock under discussion. Filter files we
- // already have.
- $existing_file_phids = $conpherence->getFilePHIDs();
- $file_phids = array_diff($file_phids, $existing_file_phids);
- if ($file_phids) {
- $files = id(new PhabricatorFileQuery())
- ->setViewer($this->getActor())
- ->withPHIDs($file_phids)
- ->execute();
- }
$xactions = array();
- if ($files) {
- $xactions[] = id(new ConpherenceTransaction())
- ->setTransactionType(ConpherenceTransaction::TYPE_FILES)
- ->setNewValue(array('+' => mpull($files, 'getPHID')));
- }
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)
->attachComment(
@@ -126,7 +90,6 @@
$types[] = ConpherenceTransaction::TYPE_TITLE;
$types[] = ConpherenceTransaction::TYPE_TOPIC;
$types[] = ConpherenceTransaction::TYPE_PARTICIPANTS;
- $types[] = ConpherenceTransaction::TYPE_FILES;
$types[] = ConpherenceTransaction::TYPE_PICTURE;
$types[] = ConpherenceTransaction::TYPE_PICTURE_CROP;
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
@@ -154,8 +117,6 @@
return array();
}
return $object->getParticipantPHIDs();
- case ConpherenceTransaction::TYPE_FILES:
- return $object->getFilePHIDs();
}
}
@@ -172,7 +133,6 @@
$file = $xaction->getNewValue();
return $file->getPHID();
case ConpherenceTransaction::TYPE_PARTICIPANTS:
- case ConpherenceTransaction::TYPE_FILES:
return $this->getPHIDTransactionNewValue($xaction);
}
}
@@ -335,27 +295,6 @@
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
- case ConpherenceTransaction::TYPE_FILES:
- $editor = new PhabricatorEdgeEditor();
- $edge_type = PhabricatorObjectHasFileEdgeType::EDGECONST;
- $old = array_fill_keys($xaction->getOldValue(), true);
- $new = array_fill_keys($xaction->getNewValue(), true);
- $add_edges = array_keys(array_diff_key($new, $old));
- $remove_edges = array_keys(array_diff_key($old, $new));
- foreach ($add_edges as $file_phid) {
- $editor->addEdge(
- $object->getPHID(),
- $edge_type,
- $file_phid);
- }
- foreach ($remove_edges as $file_phid) {
- $editor->removeEdge(
- $object->getPHID(),
- $edge_type,
- $file_phid);
- }
- $editor->save();
- break;
case ConpherenceTransaction::TYPE_PARTICIPANTS:
if ($this->getIsNewObject()) {
continue;
@@ -488,14 +427,6 @@
PhabricatorPolicyCapability::CAN_EDIT);
}
break;
- // This is similar to PhabricatorTransactions::TYPE_COMMENT so
- // use CAN_VIEW
- case ConpherenceTransaction::TYPE_FILES:
- PhabricatorPolicyFilter::requireCapability(
- $this->requireActor(),
- $object,
- PhabricatorPolicyCapability::CAN_VIEW);
- break;
case ConpherenceTransaction::TYPE_TITLE:
case ConpherenceTransaction::TYPE_TOPIC:
PhabricatorPolicyFilter::requireCapability(
@@ -514,7 +445,6 @@
switch ($type) {
case ConpherenceTransaction::TYPE_TITLE:
return $v;
- case ConpherenceTransaction::TYPE_FILES:
case ConpherenceTransaction::TYPE_PARTICIPANTS:
return $this->mergePHIDOrEdgeTransactions($u, $v);
}
diff --git a/src/applications/conpherence/query/ConpherenceThreadQuery.php b/src/applications/conpherence/query/ConpherenceThreadQuery.php
--- a/src/applications/conpherence/query/ConpherenceThreadQuery.php
+++ b/src/applications/conpherence/query/ConpherenceThreadQuery.php
@@ -13,17 +13,11 @@
private $needOrigPics;
private $needTransactions;
private $needParticipantCache;
- private $needFilePHIDs;
private $afterTransactionID;
private $beforeTransactionID;
private $transactionLimit;
private $fulltext;
- public function needFilePHIDs($need_file_phids) {
- $this->needFilePHIDs = $need_file_phids;
- return $this;
- }
-
public function needParticipantCache($participant_cache) {
$this->needParticipantCache = $participant_cache;
return $this;
@@ -116,9 +110,6 @@
if ($this->needTransactions) {
$this->loadTransactionsAndHandles($conpherences);
}
- if ($this->needFilePHIDs) {
- $this->loadFilePHIDs($conpherences);
- }
if ($this->needOrigPics || $this->needCropPics) {
$this->initImages($conpherences);
}
@@ -275,19 +266,6 @@
return $this;
}
- private function loadFilePHIDs(array $conpherences) {
- $edge_type = PhabricatorObjectHasFileEdgeType::EDGECONST;
- $file_edges = id(new PhabricatorEdgeQuery())
- ->withSourcePHIDs(array_keys($conpherences))
- ->withEdgeTypes(array($edge_type))
- ->execute();
- foreach ($file_edges as $conpherence_phid => $data) {
- $conpherence = $conpherences[$conpherence_phid];
- $conpherence->attachFilePHIDs(array_keys($data[$edge_type]));
- }
- return $this;
- }
-
private function loadOrigPics(array $conpherences) {
return $this->loadPics(
$conpherences,
diff --git a/src/applications/conpherence/storage/ConpherenceThread.php b/src/applications/conpherence/storage/ConpherenceThread.php
--- a/src/applications/conpherence/storage/ConpherenceThread.php
+++ b/src/applications/conpherence/storage/ConpherenceThread.php
@@ -20,7 +20,6 @@
private $participants = self::ATTACHABLE;
private $transactions = self::ATTACHABLE;
private $handles = self::ATTACHABLE;
- private $filePHIDs = self::ATTACHABLE;
private $images = self::ATTACHABLE;
public static function initializeNewRoom(PhabricatorUser $sender) {
@@ -31,7 +30,6 @@
->setTitle('')
->setTopic('')
->attachParticipants(array())
- ->attachFilePHIDs(array())
->attachImages(array())
->setViewPolicy($default_policy)
->setEditPolicy($default_policy)
@@ -158,14 +156,6 @@
$amount);
}
- public function attachFilePHIDs(array $file_phids) {
- $this->filePHIDs = $file_phids;
- return $this;
- }
- public function getFilePHIDs() {
- return $this->assertAttached($this->filePHIDs);
- }
-
public function loadImageURI($size) {
$file = $this->getImage($size);
diff --git a/src/applications/conpherence/storage/ConpherenceTransaction.php b/src/applications/conpherence/storage/ConpherenceTransaction.php
--- a/src/applications/conpherence/storage/ConpherenceTransaction.php
+++ b/src/applications/conpherence/storage/ConpherenceTransaction.php
@@ -2,7 +2,6 @@
final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
- const TYPE_FILES = 'files';
const TYPE_TITLE = 'title';
const TYPE_TOPIC = 'topic';
const TYPE_PARTICIPANTS = 'participants';
@@ -44,8 +43,6 @@
case self::TYPE_PICTURE:
case self::TYPE_DATE_MARKER:
return false;
- case self::TYPE_FILES:
- return true;
case self::TYPE_PICTURE_CROP:
return true;
}
@@ -68,29 +65,6 @@
case self::TYPE_PICTURE:
return $this->getRoomTitle();
break;
- case self::TYPE_FILES:
- $add = array_diff($new, $old);
- $rem = array_diff($old, $new);
-
- if ($add && $rem) {
- $title = pht(
- '%s edited files(s), added %d and removed %d.',
- $this->renderHandleLink($author_phid),
- count($add),
- count($rem));
- } else if ($add) {
- $title = pht(
- '%s added %s files(s).',
- $this->renderHandleLink($author_phid),
- phutil_count($add));
- } else {
- $title = pht(
- '%s removed %s file(s).',
- $this->renderHandleLink($author_phid),
- phutil_count($rem));
- }
- return $title;
- break;
case self::TYPE_PARTICIPANTS:
$add = array_diff($new, $old);
$rem = array_diff($old, $new);
@@ -252,7 +226,6 @@
switch ($this->getTransactionType()) {
case self::TYPE_TITLE:
case self::TYPE_PICTURE:
- case self::TYPE_FILES:
case self::TYPE_DATE_MARKER:
break;
case self::TYPE_PARTICIPANTS:
diff --git a/src/applications/conpherence/view/ConpherenceTransactionView.php b/src/applications/conpherence/view/ConpherenceTransactionView.php
--- a/src/applications/conpherence/view/ConpherenceTransactionView.php
+++ b/src/applications/conpherence/view/ConpherenceTransactionView.php
@@ -227,9 +227,6 @@
$content = null;
$handles = $this->getHandles();
switch ($transaction->getTransactionType()) {
- case ConpherenceTransaction::TYPE_FILES:
- $content = $transaction->getTitle();
- break;
case ConpherenceTransaction::TYPE_TITLE:
case ConpherenceTransaction::TYPE_TOPIC:
case ConpherenceTransaction::TYPE_PICTURE:

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 10, 12:22 PM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6725968
Default Alt Text
D16567.id39878.diff (13 KB)

Event Timeline