Skip to content

Commit 5cffe9e

Browse files
author
Chad Little
committed
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
1 parent f6023d1 commit 5cffe9e

File tree

4 files changed

+4
-117
lines changed

4 files changed

+4
-117
lines changed

src/applications/conpherence/controller/ConpherenceParticipantController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function handleRequest(AphrontRequest $request) {
1717
$conpherence = id(new ConpherenceThreadQuery())
1818
->setViewer($viewer)
1919
->withIDs(array($conpherence_id))
20-
->needWidgetData(true)
20+
->needParticipants(true)
2121
->executeOne();
2222

2323
if (!$conpherence) {

src/applications/conpherence/controller/ConpherenceUpdateController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ private function loadAndRenderUpdates(
597597
->setAfterTransactionID($latest_transaction_id)
598598
->needCropPics(true)
599599
->needParticipantCache($need_participant_cache)
600-
->needWidgetData($need_widget_data)
600+
->needParticipants(true)
601601
->needTransactions($need_transactions)
602602
->withIDs(array($conpherence_id))
603603
->executeOne();

src/applications/conpherence/query/ConpherenceThreadQuery.php

Lines changed: 2 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ final class ConpherenceThreadQuery
99
private $ids;
1010
private $participantPHIDs;
1111
private $needParticipants;
12-
private $needWidgetData;
1312
private $needCropPics;
1413
private $needOrigPics;
1514
private $needTransactions;
@@ -35,11 +34,6 @@ public function needParticipants($need) {
3534
return $this;
3635
}
3736

38-
public function needWidgetData($need_widget_data) {
39-
$this->needWidgetData = $need_widget_data;
40-
return $this;
41-
}
42-
4337
public function needCropPics($need) {
4438
$this->needCropPics = $need;
4539
return $this;
@@ -116,18 +110,15 @@ protected function loadPage() {
116110
if ($this->needParticipantCache) {
117111
$this->loadCoreHandles($conpherences, 'getRecentParticipantPHIDs');
118112
}
119-
if ($this->needWidgetData || $this->needParticipants) {
113+
if ($this->needParticipants) {
120114
$this->loadCoreHandles($conpherences, 'getParticipantPHIDs');
121115
}
122116
if ($this->needTransactions) {
123117
$this->loadTransactionsAndHandles($conpherences);
124118
}
125-
if ($this->needFilePHIDs || $this->needWidgetData) {
119+
if ($this->needFilePHIDs) {
126120
$this->loadFilePHIDs($conpherences);
127121
}
128-
if ($this->needWidgetData) {
129-
$this->loadWidgetData($conpherences);
130-
}
131122
if ($this->needOrigPics || $this->needCropPics) {
132123
$this->initImages($conpherences);
133124
}
@@ -297,101 +288,6 @@ private function loadFilePHIDs(array $conpherences) {
297288
return $this;
298289
}
299290

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-
return $this;
393-
}
394-
395291
private function loadOrigPics(array $conpherences) {
396292
return $this->loadPics(
397293
$conpherences,

src/applications/conpherence/storage/ConpherenceThread.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ final class ConpherenceThread extends ConpherenceDAO
2121
private $transactions = self::ATTACHABLE;
2222
private $handles = self::ATTACHABLE;
2323
private $filePHIDs = self::ATTACHABLE;
24-
private $widgetData = self::ATTACHABLE;
2524
private $images = self::ATTACHABLE;
2625

2726
public static function initializeNewRoom(PhabricatorUser $sender) {
@@ -167,14 +166,6 @@ public function getFilePHIDs() {
167166
return $this->assertAttached($this->filePHIDs);
168167
}
169168

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-
}
177-
178169
public function loadImageURI($size) {
179170
$file = $this->getImage($size);
180171

0 commit comments

Comments
 (0)