diff --git a/src/applications/conpherence/controller/ConpherenceParticipantController.php b/src/applications/conpherence/controller/ConpherenceParticipantController.php --- a/src/applications/conpherence/controller/ConpherenceParticipantController.php +++ b/src/applications/conpherence/controller/ConpherenceParticipantController.php @@ -17,7 +17,7 @@ $conpherence = id(new ConpherenceThreadQuery()) ->setViewer($viewer) ->withIDs(array($conpherence_id)) - ->needWidgetData(true) + ->needParticipants(true) ->executeOne(); if (!$conpherence) { 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 @@ -597,7 +597,7 @@ ->setAfterTransactionID($latest_transaction_id) ->needCropPics(true) ->needParticipantCache($need_participant_cache) - ->needWidgetData($need_widget_data) + ->needParticipants(true) ->needTransactions($need_transactions) ->withIDs(array($conpherence_id)) ->executeOne(); 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 @@ -9,7 +9,6 @@ private $ids; private $participantPHIDs; private $needParticipants; - private $needWidgetData; private $needCropPics; private $needOrigPics; private $needTransactions; @@ -35,11 +34,6 @@ return $this; } - public function needWidgetData($need_widget_data) { - $this->needWidgetData = $need_widget_data; - return $this; - } - public function needCropPics($need) { $this->needCropPics = $need; return $this; @@ -116,18 +110,15 @@ if ($this->needParticipantCache) { $this->loadCoreHandles($conpherences, 'getRecentParticipantPHIDs'); } - if ($this->needWidgetData || $this->needParticipants) { + if ($this->needParticipants) { $this->loadCoreHandles($conpherences, 'getParticipantPHIDs'); } if ($this->needTransactions) { $this->loadTransactionsAndHandles($conpherences); } - if ($this->needFilePHIDs || $this->needWidgetData) { + if ($this->needFilePHIDs) { $this->loadFilePHIDs($conpherences); } - if ($this->needWidgetData) { - $this->loadWidgetData($conpherences); - } if ($this->needOrigPics || $this->needCropPics) { $this->initImages($conpherences); } @@ -297,101 +288,6 @@ return $this; } - private function loadWidgetData(array $conpherences) { - $participant_phids = array(); - $file_phids = array(); - foreach ($conpherences as $conpherence) { - $participant_phids[] = array_keys($conpherence->getParticipants()); - $file_phids[] = $conpherence->getFilePHIDs(); - } - $participant_phids = array_mergev($participant_phids); - $file_phids = array_mergev($file_phids); - - $epochs = CalendarTimeUtil::getCalendarEventEpochs( - $this->getViewer()); - $start_epoch = $epochs['start_epoch']; - $end_epoch = $epochs['end_epoch']; - - $events = array(); - if ($participant_phids) { - // TODO: All of this Calendar code is probably extra-broken, but none - // of it is currently reachable in the UI. - $events = id(new PhabricatorCalendarEventQuery()) - ->setViewer($this->getViewer()) - ->withInvitedPHIDs($participant_phids) - ->withIsCancelled(false) - ->withDateRange($start_epoch, $end_epoch) - ->execute(); - $events = mpull($events, null, 'getPHID'); - } - - $invitees = array(); - foreach ($events as $event_phid => $event) { - foreach ($event->getInvitees() as $invitee) { - $invitees[$invitee->getInviteePHID()][$event_phid] = true; - } - } - - // attached files - $files = array(); - $file_author_phids = array(); - $authors = array(); - if ($file_phids) { - $files = id(new PhabricatorFileQuery()) - ->setViewer($this->getViewer()) - ->withPHIDs($file_phids) - ->execute(); - $files = mpull($files, null, 'getPHID'); - $file_author_phids = mpull($files, 'getAuthorPHID', 'getPHID'); - $authors = id(new PhabricatorHandleQuery()) - ->setViewer($this->getViewer()) - ->withPHIDs($file_author_phids) - ->execute(); - $authors = mpull($authors, null, 'getPHID'); - } - - foreach ($conpherences as $phid => $conpherence) { - $participant_phids = array_keys($conpherence->getParticipants()); - $widget_data = array(); - - $event_phids = array(); - $participant_invites = array_select_keys($invitees, $participant_phids); - foreach ($participant_invites as $invite_set) { - $event_phids += $invite_set; - } - $thread_events = array_select_keys($events, array_keys($event_phids)); - $thread_events = msort($thread_events, 'getDateFrom'); - $widget_data['events'] = $thread_events; - - $conpherence_files = array(); - $files_authors = array(); - foreach ($conpherence->getFilePHIDs() as $curr_phid) { - $curr_file = idx($files, $curr_phid); - if (!$curr_file) { - // this file was deleted or user doesn't have permission to see it - // this is generally weird - continue; - } - $conpherence_files[$curr_phid] = $curr_file; - // some files don't have authors so be careful - $current_author = null; - $current_author_phid = idx($file_author_phids, $curr_phid); - if ($current_author_phid) { - $current_author = $authors[$current_author_phid]; - } - $files_authors[$curr_phid] = $current_author; - } - $widget_data += array( - 'files' => $conpherence_files, - 'files_authors' => $files_authors, - ); - - $conpherence->attachWidgetData($widget_data); - } - - 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 @@ -21,7 +21,6 @@ private $transactions = self::ATTACHABLE; private $handles = self::ATTACHABLE; private $filePHIDs = self::ATTACHABLE; - private $widgetData = self::ATTACHABLE; private $images = self::ATTACHABLE; public static function initializeNewRoom(PhabricatorUser $sender) { @@ -167,14 +166,6 @@ return $this->assertAttached($this->filePHIDs); } - public function attachWidgetData(array $widget_data) { - $this->widgetData = $widget_data; - return $this; - } - public function getWidgetData() { - return $this->assertAttached($this->widgetData); - } - public function loadImageURI($size) { $file = $this->getImage($size);