@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 "needWidgetData" from Conpherence

Summary: We no longer have widgets, don't need these calls for simplicity.

Test Plan: Add a user to a room, remove a user from a room. Grep for `needWidgetData`

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D16562

+4 -117
+1 -1
src/applications/conpherence/controller/ConpherenceParticipantController.php
··· 17 17 $conpherence = id(new ConpherenceThreadQuery()) 18 18 ->setViewer($viewer) 19 19 ->withIDs(array($conpherence_id)) 20 - ->needWidgetData(true) 20 + ->needParticipants(true) 21 21 ->executeOne(); 22 22 23 23 if (!$conpherence) {
+1 -1
src/applications/conpherence/controller/ConpherenceUpdateController.php
··· 597 597 ->setAfterTransactionID($latest_transaction_id) 598 598 ->needCropPics(true) 599 599 ->needParticipantCache($need_participant_cache) 600 - ->needWidgetData($need_widget_data) 600 + ->needParticipants(true) 601 601 ->needTransactions($need_transactions) 602 602 ->withIDs(array($conpherence_id)) 603 603 ->executeOne();
+2 -106
src/applications/conpherence/query/ConpherenceThreadQuery.php
··· 9 9 private $ids; 10 10 private $participantPHIDs; 11 11 private $needParticipants; 12 - private $needWidgetData; 13 12 private $needCropPics; 14 13 private $needOrigPics; 15 14 private $needTransactions; ··· 32 31 33 32 public function needParticipants($need) { 34 33 $this->needParticipants = $need; 35 - return $this; 36 - } 37 - 38 - public function needWidgetData($need_widget_data) { 39 - $this->needWidgetData = $need_widget_data; 40 34 return $this; 41 35 } 42 36 ··· 116 110 if ($this->needParticipantCache) { 117 111 $this->loadCoreHandles($conpherences, 'getRecentParticipantPHIDs'); 118 112 } 119 - if ($this->needWidgetData || $this->needParticipants) { 113 + if ($this->needParticipants) { 120 114 $this->loadCoreHandles($conpherences, 'getParticipantPHIDs'); 121 115 } 122 116 if ($this->needTransactions) { 123 117 $this->loadTransactionsAndHandles($conpherences); 124 118 } 125 - if ($this->needFilePHIDs || $this->needWidgetData) { 119 + if ($this->needFilePHIDs) { 126 120 $this->loadFilePHIDs($conpherences); 127 - } 128 - if ($this->needWidgetData) { 129 - $this->loadWidgetData($conpherences); 130 121 } 131 122 if ($this->needOrigPics || $this->needCropPics) { 132 123 $this->initImages($conpherences); ··· 294 285 $conpherence = $conpherences[$conpherence_phid]; 295 286 $conpherence->attachFilePHIDs(array_keys($data[$edge_type])); 296 287 } 297 - return $this; 298 - } 299 - 300 - private function loadWidgetData(array $conpherences) { 301 - $participant_phids = array(); 302 - $file_phids = array(); 303 - foreach ($conpherences as $conpherence) { 304 - $participant_phids[] = array_keys($conpherence->getParticipants()); 305 - $file_phids[] = $conpherence->getFilePHIDs(); 306 - } 307 - $participant_phids = array_mergev($participant_phids); 308 - $file_phids = array_mergev($file_phids); 309 - 310 - $epochs = CalendarTimeUtil::getCalendarEventEpochs( 311 - $this->getViewer()); 312 - $start_epoch = $epochs['start_epoch']; 313 - $end_epoch = $epochs['end_epoch']; 314 - 315 - $events = array(); 316 - if ($participant_phids) { 317 - // TODO: All of this Calendar code is probably extra-broken, but none 318 - // of it is currently reachable in the UI. 319 - $events = id(new PhabricatorCalendarEventQuery()) 320 - ->setViewer($this->getViewer()) 321 - ->withInvitedPHIDs($participant_phids) 322 - ->withIsCancelled(false) 323 - ->withDateRange($start_epoch, $end_epoch) 324 - ->execute(); 325 - $events = mpull($events, null, 'getPHID'); 326 - } 327 - 328 - $invitees = array(); 329 - foreach ($events as $event_phid => $event) { 330 - foreach ($event->getInvitees() as $invitee) { 331 - $invitees[$invitee->getInviteePHID()][$event_phid] = true; 332 - } 333 - } 334 - 335 - // attached files 336 - $files = array(); 337 - $file_author_phids = array(); 338 - $authors = array(); 339 - if ($file_phids) { 340 - $files = id(new PhabricatorFileQuery()) 341 - ->setViewer($this->getViewer()) 342 - ->withPHIDs($file_phids) 343 - ->execute(); 344 - $files = mpull($files, null, 'getPHID'); 345 - $file_author_phids = mpull($files, 'getAuthorPHID', 'getPHID'); 346 - $authors = id(new PhabricatorHandleQuery()) 347 - ->setViewer($this->getViewer()) 348 - ->withPHIDs($file_author_phids) 349 - ->execute(); 350 - $authors = mpull($authors, null, 'getPHID'); 351 - } 352 - 353 - foreach ($conpherences as $phid => $conpherence) { 354 - $participant_phids = array_keys($conpherence->getParticipants()); 355 - $widget_data = array(); 356 - 357 - $event_phids = array(); 358 - $participant_invites = array_select_keys($invitees, $participant_phids); 359 - foreach ($participant_invites as $invite_set) { 360 - $event_phids += $invite_set; 361 - } 362 - $thread_events = array_select_keys($events, array_keys($event_phids)); 363 - $thread_events = msort($thread_events, 'getDateFrom'); 364 - $widget_data['events'] = $thread_events; 365 - 366 - $conpherence_files = array(); 367 - $files_authors = array(); 368 - foreach ($conpherence->getFilePHIDs() as $curr_phid) { 369 - $curr_file = idx($files, $curr_phid); 370 - if (!$curr_file) { 371 - // this file was deleted or user doesn't have permission to see it 372 - // this is generally weird 373 - continue; 374 - } 375 - $conpherence_files[$curr_phid] = $curr_file; 376 - // some files don't have authors so be careful 377 - $current_author = null; 378 - $current_author_phid = idx($file_author_phids, $curr_phid); 379 - if ($current_author_phid) { 380 - $current_author = $authors[$current_author_phid]; 381 - } 382 - $files_authors[$curr_phid] = $current_author; 383 - } 384 - $widget_data += array( 385 - 'files' => $conpherence_files, 386 - 'files_authors' => $files_authors, 387 - ); 388 - 389 - $conpherence->attachWidgetData($widget_data); 390 - } 391 - 392 288 return $this; 393 289 } 394 290
-9
src/applications/conpherence/storage/ConpherenceThread.php
··· 21 21 private $transactions = self::ATTACHABLE; 22 22 private $handles = self::ATTACHABLE; 23 23 private $filePHIDs = self::ATTACHABLE; 24 - private $widgetData = self::ATTACHABLE; 25 24 private $images = self::ATTACHABLE; 26 25 27 26 public static function initializeNewRoom(PhabricatorUser $sender) { ··· 165 164 } 166 165 public function getFilePHIDs() { 167 166 return $this->assertAttached($this->filePHIDs); 168 - } 169 - 170 - public function attachWidgetData(array $widget_data) { 171 - $this->widgetData = $widget_data; 172 - return $this; 173 - } 174 - public function getWidgetData() { 175 - return $this->assertAttached($this->widgetData); 176 167 } 177 168 178 169 public function loadImageURI($size) {