@@ -9,7 +9,6 @@ final class ConpherenceThreadQuery
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 ;
@@ -35,11 +34,6 @@ public function needParticipants($need) {
35
34
return $ this ;
36
35
}
37
36
38
- public function needWidgetData ($ need_widget_data ) {
39
- $ this ->needWidgetData = $ need_widget_data ;
40
- return $ this ;
41
- }
42
-
43
37
public function needCropPics ($ need ) {
44
38
$ this ->needCropPics = $ need ;
45
39
return $ this ;
@@ -116,18 +110,15 @@ protected function loadPage() {
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
121
}
128
- if ($ this ->needWidgetData ) {
129
- $ this ->loadWidgetData ($ conpherences );
130
- }
131
122
if ($ this ->needOrigPics || $ this ->needCropPics ) {
132
123
$ this ->initImages ($ conpherences );
133
124
}
@@ -297,101 +288,6 @@ private function loadFilePHIDs(array $conpherences) {
297
288
return $ this ;
298
289
}
299
290
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
-
395
291
private function loadOrigPics (array $ conpherences ) {
396
292
return $ this ->loadPics (
397
293
$ conpherences ,
0 commit comments