mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-26 07:20:57 +01:00
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
This commit is contained in:
parent
76d0b67d91
commit
f46263903c
4 changed files with 5 additions and 19 deletions
|
@ -36,8 +36,7 @@ final class ConpherenceQueryThreadConduitAPIMethod
|
|||
$offset = $request->getValue('offset');
|
||||
|
||||
$query = id(new ConpherenceThreadQuery())
|
||||
->setViewer($user)
|
||||
->needParticipantCache(true);
|
||||
->setViewer($user);
|
||||
|
||||
if ($ids) {
|
||||
$conpherences = $query
|
||||
|
@ -57,7 +56,7 @@ final class ConpherenceQueryThreadConduitAPIMethod
|
|||
->setLimit($limit)
|
||||
->setOffset($offset)
|
||||
->execute();
|
||||
$conpherence_phids = array_keys($participation);
|
||||
$conpherence_phids = mpull($participation, 'getConpherencePHID');
|
||||
$query->withPHIDs($conpherence_phids);
|
||||
$conpherences = $query->execute();
|
||||
$conpherences = array_select_keys($conpherences, $conpherence_phids);
|
||||
|
|
|
@ -151,6 +151,7 @@ final class ConpherenceListController extends ConpherenceController {
|
|||
->withParticipantPHIDs(array($viewer->getPHID()))
|
||||
->setLimit($limit)
|
||||
->execute();
|
||||
$all_participation = mpull($all_participation, null, 'getConpherencePHID');
|
||||
|
||||
return array(
|
||||
'all_participation' => $all_participation,
|
||||
|
|
|
@ -12,6 +12,7 @@ final class ConpherenceNotificationPanelController
|
|||
->withParticipantPHIDs(array($user->getPHID()))
|
||||
->setLimit(5)
|
||||
->execute();
|
||||
$participant_data = mpull($participant_data, null, 'getConpherencePHID');
|
||||
|
||||
if ($participant_data) {
|
||||
$conpherences = id(new ConpherenceThreadQuery())
|
||||
|
|
|
@ -25,22 +25,7 @@ final class ConpherenceParticipantQuery extends PhabricatorOffsetPagedQuery {
|
|||
$this->buildOrderClause($conn),
|
||||
$this->buildLimitClause($conn));
|
||||
|
||||
$participants = $table->loadAllFromArray($data);
|
||||
|
||||
// TODO: Fix this, it's bogus.
|
||||
if ('garbage') {
|
||||
if (count($this->participantPHIDs) !== 1) {
|
||||
throw new Exception(
|
||||
pht(
|
||||
'This query only works when querying for exactly one participant '.
|
||||
'PHID!'));
|
||||
}
|
||||
// This will throw results away if we aren't doing a query for exactly
|
||||
// one participant PHID.
|
||||
$participants = mpull($participants, null, 'getConpherencePHID');
|
||||
}
|
||||
|
||||
return $participants;
|
||||
return $table->loadAllFromArray($data);
|
||||
}
|
||||
|
||||
protected function buildWhereClause(AphrontDatabaseConnection $conn) {
|
||||
|
|
Loading…
Reference in a new issue