@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+7 -153
+2
resources/sql/autopatches/20170413.conpherence.01.recentparty.sql
··· 1 + ALTER TABLE {$NAMESPACE}_conpherence.conpherence_thread 2 + DROP COLUMN recentParticipantPHIDs;
+2 -15
src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php
··· 16 16 17 17 $this->assertTrue((bool)$conpherence->getID()); 18 18 $this->assertEqual(1, count($conpherence->getParticipants())); 19 - $this->assertEqual( 20 - $participant_phids, 21 - $conpherence->getRecentParticipantPHIDs()); 22 19 } 23 20 24 21 public function testNUserRoomCreate() { ··· 38 35 39 36 $this->assertTrue((bool)$conpherence->getID()); 40 37 $this->assertEqual(4, count($conpherence->getParticipants())); 41 - $this->assertEqual( 42 - $participant_phids, 43 - $conpherence->getRecentParticipantPHIDs()); 44 38 } 45 39 46 40 public function testRoomParticipantAddition() { ··· 58 52 59 53 $this->assertTrue((bool)$conpherence->getID()); 60 54 $this->assertEqual(2, count($conpherence->getParticipants())); 61 - $this->assertEqual( 62 - $participant_phids, 63 - $conpherence->getRecentParticipantPHIDs()); 64 55 65 56 // test add by creator 66 57 $participant_phids[] = $friend_2->getPHID(); 67 58 $this->addParticipants($creator, $conpherence, array($friend_2->getPHID())); 68 - $this->assertEqual( 69 - $participant_phids, 70 - $conpherence->getRecentParticipantPHIDs()); 59 + $this->assertEqual(3, count($conpherence->getParticipants())); 71 60 72 61 // test add by other participant, so recent participation should 73 62 // meaningfully change ··· 81 70 $friend_2, 82 71 $conpherence, 83 72 array($friend_3->getPHID())); 84 - $this->assertEqual( 85 - $participant_phids, 86 - $conpherence->getRecentParticipantPHIDs()); 73 + $this->assertEqual(4, count($conpherence->getParticipants())); 87 74 } 88 75 89 76 public function testRoomParticipantDeletion() {
-1
src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php
··· 71 71 'conpherencePHID' => $conpherence->getPHID(), 72 72 'conpherenceTitle' => $conpherence->getTitle(), 73 73 'messageCount' => $conpherence->getMessageCount(), 74 - 'recentParticipantPHIDs' => $conpherence->getRecentParticipantPHIDs(), 75 74 'conpherenceURI' => $this->getConpherenceURI($conpherence), 76 75 ); 77 76 }
-1
src/applications/conpherence/controller/ConpherenceColumnViewController.php
··· 17 17 ->setViewer($user) 18 18 ->withPHIDs($conpherence_phids) 19 19 ->needProfileImage(true) 20 - ->needParticipantCache(true) 21 20 ->execute(); 22 21 $latest_conpherences = mpull($latest_conpherences, null, 'getPHID'); 23 22 $latest_conpherences = array_select_keys(
-1
src/applications/conpherence/controller/ConpherenceListController.php
··· 159 159 ->setViewer($user) 160 160 ->withPHIDs($conpherence_phids) 161 161 ->needProfileImage(true) 162 - ->needParticipantCache(true) 163 162 ->execute(); 164 163 165 164 // this will re-sort by participation data
-1
src/applications/conpherence/controller/ConpherenceNotificationPanelController.php
··· 21 21 ->needProfileImage(true) 22 22 ->needTransactions(true) 23 23 ->setTransactionLimit(100) 24 - ->needParticipantCache(true) 25 24 ->execute(); 26 25 } 27 26
-2
src/applications/conpherence/controller/ConpherenceUpdateController.php
··· 470 470 $latest_transaction_id) { 471 471 472 472 $need_transactions = false; 473 - $need_participant_cache = true; 474 473 switch ($action) { 475 474 case ConpherenceUpdateActions::METADATA: 476 475 case ConpherenceUpdateActions::LOAD: ··· 491 490 ->setViewer($user) 492 491 ->setAfterTransactionID($latest_transaction_id) 493 492 ->needProfileImage(true) 494 - ->needParticipantCache($need_participant_cache) 495 493 ->needParticipants(true) 496 494 ->needTransactions($need_transactions) 497 495 ->withIDs(array($conpherence_id))
-1
src/applications/conpherence/controller/ConpherenceViewController.php
··· 20 20 ->setViewer($user) 21 21 ->withIDs(array($conpherence_id)) 22 22 ->needProfileImage(true) 23 - ->needParticipantCache(true) 24 23 ->needTransactions(true) 25 24 ->setTransactionLimit($this->getMainQueryLimit()); 26 25
+1 -40
src/applications/conpherence/editor/ConpherenceEditor.php
··· 190 190 ->setSeenMessageCount($message_count) 191 191 ->save(); 192 192 $object->attachParticipants($participants); 193 - $object->setRecentParticipantPHIDs(array_keys($participants)); 194 193 } 195 194 break; 196 195 } ··· 201 200 PhabricatorLiskDAO $object, 202 201 PhabricatorApplicationTransaction $xaction) { 203 202 204 - $make_author_recent_participant = true; 205 203 switch ($xaction->getTransactionType()) { 206 204 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()) {} 231 206 break; 232 207 } 233 208 234 - if ($make_author_recent_participant) { 235 - $this->makeAuthorMostRecentParticipant($object, $xaction); 236 - } 237 209 } 238 210 239 211 protected function applyBuiltinInternalTransaction( ··· 247 219 } 248 220 249 221 return parent::applyBuiltinInternalTransaction($object, $xaction); 250 - } 251 - 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 222 } 262 223 263 224 protected function applyCustomExternalTransaction(
-9
src/applications/conpherence/query/ConpherenceThreadQuery.php
··· 10 10 private $participantPHIDs; 11 11 private $needParticipants; 12 12 private $needTransactions; 13 - private $needParticipantCache; 14 13 private $afterTransactionID; 15 14 private $beforeTransactionID; 16 15 private $transactionLimit; 17 16 private $fulltext; 18 17 private $needProfileImage; 19 - 20 - public function needParticipantCache($participant_cache) { 21 - $this->needParticipantCache = $participant_cache; 22 - return $this; 23 - } 24 18 25 19 public function needParticipants($need) { 26 20 $this->needParticipants = $need; ··· 101 95 if ($conpherences) { 102 96 $conpherences = mpull($conpherences, null, 'getPHID'); 103 97 $this->loadParticipantsAndInitHandles($conpherences); 104 - if ($this->needParticipantCache) { 105 - $this->loadCoreHandles($conpherences, 'getRecentParticipantPHIDs'); 106 - } 107 98 if ($this->needParticipants) { 108 99 $this->loadCoreHandles($conpherences, 'getParticipantPHIDs'); 109 100 }
+1 -10
src/applications/conpherence/query/ConpherenceThreadSearchEngine.php
··· 13 13 14 14 public function newQuery() { 15 15 return id(new ConpherenceThreadQuery()) 16 - ->needParticipantCache(true) 17 16 ->needProfileImage(true); 18 17 } 19 18 ··· 92 91 return parent::buildSavedQueryFromBuiltin($query_key); 93 92 } 94 93 95 - protected function getRequiredHandlePHIDsForResultList( 96 - array $conpherences, 97 - PhabricatorSavedQuery $query) { 98 - 99 - $recent = mpull($conpherences, 'getRecentParticipantPHIDs'); 100 - return array_unique(array_mergev($recent)); 101 - } 102 - 103 94 protected function renderResultList( 104 95 array $conpherences, 105 96 PhabricatorSavedQuery $query, ··· 153 144 $list->setUser($viewer); 154 145 foreach ($conpherences as $conpherence_phid => $conpherence) { 155 146 $created = phabricator_date($conpherence->getDateCreated(), $viewer); 156 - $title = $conpherence->getDisplayTitle($viewer); 147 + $title = $conpherence->getTitle(); 157 148 $monogram = $conpherence->getMonogram(); 158 149 159 150 $icon_name = $conpherence->getPolicyIconName($policy_objects);
+1 -71
src/applications/conpherence/storage/ConpherenceThread.php
··· 12 12 protected $topic; 13 13 protected $profileImagePHID; 14 14 protected $messageCount; 15 - protected $recentParticipantPHIDs = array(); 16 15 protected $mailKey; 17 16 protected $viewPolicy; 18 17 protected $editPolicy; ··· 39 38 protected function getConfiguration() { 40 39 return array( 41 40 self::CONFIG_AUX_PHID => true, 42 - self::CONFIG_SERIALIZATION => array( 43 - 'recentParticipantPHIDs' => self::SERIALIZATION_JSON, 44 - ), 45 41 self::CONFIG_COLUMN_SCHEMA => array( 46 42 'title' => 'text255?', 47 43 'topic' => 'text255', ··· 165 161 return pht('Private Room'); 166 162 } 167 163 168 - /** 169 - * Get the thread's display title for a user. 170 - * 171 - * If a thread doesn't have a title set, this will return a string describing 172 - * recent participants. 173 - * 174 - * @param PhabricatorUser Viewer. 175 - * @return string Thread title. 176 - */ 177 - public function getDisplayTitle(PhabricatorUser $viewer) { 178 - $title = $this->getTitle(); 179 - if (strlen($title)) { 180 - return $title; 181 - } 182 - 183 - return $this->getRecentParticipantsString($viewer); 184 - } 185 - 186 - 187 - /** 188 - * Get recent participants (other than the viewer) as a string. 189 - * 190 - * For example, this method might return "alincoln, htaft, gwashington...". 191 - * 192 - * @param PhabricatorUser Viewer. 193 - * @return string Description of other participants. 194 - */ 195 - private function getRecentParticipantsString(PhabricatorUser $viewer) { 196 - $handles = $this->getHandles(); 197 - $phids = $this->getOtherRecentParticipantPHIDs($viewer); 198 - 199 - if (count($phids) == 0) { 200 - $phids[] = $viewer->getPHID(); 201 - $more = false; 202 - } else { 203 - $limit = 3; 204 - $more = (count($phids) > $limit); 205 - $phids = array_slice($phids, 0, $limit); 206 - } 207 - 208 - $names = array_select_keys($handles, $phids); 209 - $names = mpull($names, 'getName'); 210 - $names = implode(', ', $names); 211 - 212 - if ($more) { 213 - $names = $names.'...'; 214 - } 215 - 216 - return $names; 217 - } 218 - 219 - 220 - /** 221 - * Get PHIDs for recent participants who are not the viewer. 222 - * 223 - * @param PhabricatorUser Viewer. 224 - * @return list<phid> Participants who are not the viewer. 225 - */ 226 - private function getOtherRecentParticipantPHIDs(PhabricatorUser $viewer) { 227 - $phids = $this->getRecentParticipantPHIDs(); 228 - $phids = array_fuse($phids); 229 - unset($phids[$viewer->getPHID()]); 230 - return array_values($phids); 231 - } 232 - 233 - 234 164 public function getDisplayData(PhabricatorUser $viewer) { 235 165 $handles = $this->getHandles(); 236 166 ··· 277 207 } 278 208 $unread_count = $this->getMessageCount() - $user_seen_count; 279 209 280 - $title = $this->getDisplayTitle($viewer); 210 + $title = $this->getTitle(); 281 211 $topic = $this->getTopic(); 282 212 283 213 return array(
-1
src/applications/search/menuitem/PhabricatorConpherenceProfileMenuItem.php
··· 45 45 $rooms = id(new ConpherenceThreadQuery()) 46 46 ->setViewer($viewer) 47 47 ->withPHIDs($room_phids) 48 - ->needParticipantCache(true) 49 48 ->needProfileImage(true) 50 49 ->execute(); 51 50