Skip to content

Commit f462639

Browse files
author
epriestley
committed
Fix improper filtering behavior in ConpherenceParticipantQuery
Summary: Pathway to D17685. This fixes an issue idenified in D17731: if any caller ever queried for more than one participant, some results could get thrown away by re-keying the results on thread PHID: two different participants can be members of the same thread! This also fixes an issue from D17683, where a `needParticipantCache()` callsite was overlooked. Test Plan: - Viewed Conpherence dropdown. - Sent messages, saw unread count / thread order still work properly. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D17732
1 parent 76d0b67 commit f462639

File tree

4 files changed

+5
-19
lines changed

4 files changed

+5
-19
lines changed

src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ protected function execute(ConduitAPIRequest $request) {
3636
$offset = $request->getValue('offset');
3737

3838
$query = id(new ConpherenceThreadQuery())
39-
->setViewer($user)
40-
->needParticipantCache(true);
39+
->setViewer($user);
4140

4241
if ($ids) {
4342
$conpherences = $query
@@ -57,7 +56,7 @@ protected function execute(ConduitAPIRequest $request) {
5756
->setLimit($limit)
5857
->setOffset($offset)
5958
->execute();
60-
$conpherence_phids = array_keys($participation);
59+
$conpherence_phids = mpull($participation, 'getConpherencePHID');
6160
$query->withPHIDs($conpherence_phids);
6261
$conpherences = $query->execute();
6362
$conpherences = array_select_keys($conpherences, $conpherence_phids);

src/applications/conpherence/controller/ConpherenceListController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ private function loadDefaultParticipation($limit) {
151151
->withParticipantPHIDs(array($viewer->getPHID()))
152152
->setLimit($limit)
153153
->execute();
154+
$all_participation = mpull($all_participation, null, 'getConpherencePHID');
154155

155156
return array(
156157
'all_participation' => $all_participation,

src/applications/conpherence/controller/ConpherenceNotificationPanelController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public function handleRequest(AphrontRequest $request) {
1212
->withParticipantPHIDs(array($user->getPHID()))
1313
->setLimit(5)
1414
->execute();
15+
$participant_data = mpull($participant_data, null, 'getConpherencePHID');
1516

1617
if ($participant_data) {
1718
$conpherences = id(new ConpherenceThreadQuery())

src/applications/conpherence/query/ConpherenceParticipantQuery.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,7 @@ public function execute() {
2525
$this->buildOrderClause($conn),
2626
$this->buildLimitClause($conn));
2727

28-
$participants = $table->loadAllFromArray($data);
29-
30-
// TODO: Fix this, it's bogus.
31-
if ('garbage') {
32-
if (count($this->participantPHIDs) !== 1) {
33-
throw new Exception(
34-
pht(
35-
'This query only works when querying for exactly one participant '.
36-
'PHID!'));
37-
}
38-
// This will throw results away if we aren't doing a query for exactly
39-
// one participant PHID.
40-
$participants = mpull($participants, null, 'getConpherencePHID');
41-
}
42-
43-
return $participants;
28+
return $table->loadAllFromArray($data);
4429
}
4530

4631
protected function buildWhereClause(AphrontDatabaseConnection $conn) {

0 commit comments

Comments
 (0)