Skip to content

Commit 5587abf

Browse files
author
Chad Little
committed
Remove recentParticipants from ConpherenceThread
Summary: We no longer display this any more in the UI, so go ahead and remove the callsites and db column. Test Plan: New Room, with and without participants. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17683
1 parent ce06a05 commit 5587abf

13 files changed

+7
-153
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE {$NAMESPACE}_conpherence.conpherence_thread
2+
DROP COLUMN recentParticipantPHIDs;

src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ public function testOneUserRoomCreate() {
1616

1717
$this->assertTrue((bool)$conpherence->getID());
1818
$this->assertEqual(1, count($conpherence->getParticipants()));
19-
$this->assertEqual(
20-
$participant_phids,
21-
$conpherence->getRecentParticipantPHIDs());
2219
}
2320

2421
public function testNUserRoomCreate() {
@@ -38,9 +35,6 @@ public function testNUserRoomCreate() {
3835

3936
$this->assertTrue((bool)$conpherence->getID());
4037
$this->assertEqual(4, count($conpherence->getParticipants()));
41-
$this->assertEqual(
42-
$participant_phids,
43-
$conpherence->getRecentParticipantPHIDs());
4438
}
4539

4640
public function testRoomParticipantAddition() {
@@ -58,16 +52,11 @@ public function testRoomParticipantAddition() {
5852

5953
$this->assertTrue((bool)$conpherence->getID());
6054
$this->assertEqual(2, count($conpherence->getParticipants()));
61-
$this->assertEqual(
62-
$participant_phids,
63-
$conpherence->getRecentParticipantPHIDs());
6455

6556
// test add by creator
6657
$participant_phids[] = $friend_2->getPHID();
6758
$this->addParticipants($creator, $conpherence, array($friend_2->getPHID()));
68-
$this->assertEqual(
69-
$participant_phids,
70-
$conpherence->getRecentParticipantPHIDs());
59+
$this->assertEqual(3, count($conpherence->getParticipants()));
7160

7261
// test add by other participant, so recent participation should
7362
// meaningfully change
@@ -81,9 +70,7 @@ public function testRoomParticipantAddition() {
8170
$friend_2,
8271
$conpherence,
8372
array($friend_3->getPHID()));
84-
$this->assertEqual(
85-
$participant_phids,
86-
$conpherence->getRecentParticipantPHIDs());
73+
$this->assertEqual(4, count($conpherence->getParticipants()));
8774
}
8875

8976
public function testRoomParticipantDeletion() {

src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ protected function execute(ConduitAPIRequest $request) {
7171
'conpherencePHID' => $conpherence->getPHID(),
7272
'conpherenceTitle' => $conpherence->getTitle(),
7373
'messageCount' => $conpherence->getMessageCount(),
74-
'recentParticipantPHIDs' => $conpherence->getRecentParticipantPHIDs(),
7574
'conpherenceURI' => $this->getConpherenceURI($conpherence),
7675
);
7776
}

src/applications/conpherence/controller/ConpherenceColumnViewController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public function handleRequest(AphrontRequest $request) {
1717
->setViewer($user)
1818
->withPHIDs($conpherence_phids)
1919
->needProfileImage(true)
20-
->needParticipantCache(true)
2120
->execute();
2221
$latest_conpherences = mpull($latest_conpherences, null, 'getPHID');
2322
$latest_conpherences = array_select_keys(

src/applications/conpherence/controller/ConpherenceListController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ private function loadConpherenceThreadData($participation) {
159159
->setViewer($user)
160160
->withPHIDs($conpherence_phids)
161161
->needProfileImage(true)
162-
->needParticipantCache(true)
163162
->execute();
164163

165164
// this will re-sort by participation data

src/applications/conpherence/controller/ConpherenceNotificationPanelController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public function handleRequest(AphrontRequest $request) {
2121
->needProfileImage(true)
2222
->needTransactions(true)
2323
->setTransactionLimit(100)
24-
->needParticipantCache(true)
2524
->execute();
2625
}
2726

src/applications/conpherence/controller/ConpherenceUpdateController.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,6 @@ private function loadAndRenderUpdates(
470470
$latest_transaction_id) {
471471

472472
$need_transactions = false;
473-
$need_participant_cache = true;
474473
switch ($action) {
475474
case ConpherenceUpdateActions::METADATA:
476475
case ConpherenceUpdateActions::LOAD:
@@ -491,7 +490,6 @@ private function loadAndRenderUpdates(
491490
->setViewer($user)
492491
->setAfterTransactionID($latest_transaction_id)
493492
->needProfileImage(true)
494-
->needParticipantCache($need_participant_cache)
495493
->needParticipants(true)
496494
->needTransactions($need_transactions)
497495
->withIDs(array($conpherence_id))

src/applications/conpherence/controller/ConpherenceViewController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public function handleRequest(AphrontRequest $request) {
2020
->setViewer($user)
2121
->withIDs(array($conpherence_id))
2222
->needProfileImage(true)
23-
->needParticipantCache(true)
2423
->needTransactions(true)
2524
->setTransactionLimit($this->getMainQueryLimit());
2625

src/applications/conpherence/editor/ConpherenceEditor.php

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ protected function applyInitialEffects(
190190
->setSeenMessageCount($message_count)
191191
->save();
192192
$object->attachParticipants($participants);
193-
$object->setRecentParticipantPHIDs(array_keys($participants));
194193
}
195194
break;
196195
}
@@ -201,39 +200,12 @@ protected function applyCustomInternalTransaction(
201200
PhabricatorLiskDAO $object,
202201
PhabricatorApplicationTransaction $xaction) {
203202

204-
$make_author_recent_participant = true;
205203
switch ($xaction->getTransactionType()) {
206204
case ConpherenceTransaction::TYPE_PARTICIPANTS:
207-
if (!$this->getIsNewObject()) {
208-
$old_map = array_fuse($xaction->getOldValue());
209-
$new_map = array_fuse($xaction->getNewValue());
210-
// if we added people, add them to the end of "recent" participants
211-
$add = array_keys(array_diff_key($new_map, $old_map));
212-
// if we remove people, then definintely remove them from "recent"
213-
// participants
214-
$del = array_keys(array_diff_key($old_map, $new_map));
215-
if ($add || $del) {
216-
$participants = $object->getRecentParticipantPHIDs();
217-
if ($add) {
218-
$participants = array_merge($participants, $add);
219-
}
220-
if ($del) {
221-
$participants = array_diff($participants, $del);
222-
$actor = $this->requireActor();
223-
if (in_array($actor->getPHID(), $del)) {
224-
$make_author_recent_participant = false;
225-
}
226-
}
227-
$participants = array_slice(array_unique($participants), 0, 10);
228-
$object->setRecentParticipantPHIDs($participants);
229-
}
230-
}
205+
if (!$this->getIsNewObject()) {}
231206
break;
232207
}
233208

234-
if ($make_author_recent_participant) {
235-
$this->makeAuthorMostRecentParticipant($object, $xaction);
236-
}
237209
}
238210

239211
protected function applyBuiltinInternalTransaction(
@@ -249,17 +221,6 @@ protected function applyBuiltinInternalTransaction(
249221
return parent::applyBuiltinInternalTransaction($object, $xaction);
250222
}
251223

252-
private function makeAuthorMostRecentParticipant(
253-
PhabricatorLiskDAO $object,
254-
PhabricatorApplicationTransaction $xaction) {
255-
256-
$participants = $object->getRecentParticipantPHIDs();
257-
array_unshift($participants, $xaction->getAuthorPHID());
258-
$participants = array_slice(array_unique($participants), 0, 10);
259-
260-
$object->setRecentParticipantPHIDs($participants);
261-
}
262-
263224
protected function applyCustomExternalTransaction(
264225
PhabricatorLiskDAO $object,
265226
PhabricatorApplicationTransaction $xaction) {

src/applications/conpherence/query/ConpherenceThreadQuery.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,12 @@ final class ConpherenceThreadQuery
1010
private $participantPHIDs;
1111
private $needParticipants;
1212
private $needTransactions;
13-
private $needParticipantCache;
1413
private $afterTransactionID;
1514
private $beforeTransactionID;
1615
private $transactionLimit;
1716
private $fulltext;
1817
private $needProfileImage;
1918

20-
public function needParticipantCache($participant_cache) {
21-
$this->needParticipantCache = $participant_cache;
22-
return $this;
23-
}
24-
2519
public function needParticipants($need) {
2620
$this->needParticipants = $need;
2721
return $this;
@@ -101,9 +95,6 @@ protected function loadPage() {
10195
if ($conpherences) {
10296
$conpherences = mpull($conpherences, null, 'getPHID');
10397
$this->loadParticipantsAndInitHandles($conpherences);
104-
if ($this->needParticipantCache) {
105-
$this->loadCoreHandles($conpherences, 'getRecentParticipantPHIDs');
106-
}
10798
if ($this->needParticipants) {
10899
$this->loadCoreHandles($conpherences, 'getParticipantPHIDs');
109100
}

0 commit comments

Comments
 (0)