mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 20:40:56 +01:00
Give ConpherenceThreadQuery a primary table alias
Summary: Fixes T11113. On the 2nd+ page, we could end up with an ambiguous `id` WHERE clause because we don't define a primary table alias on this query. Define one. Test Plan: Changed SearchEngine to return pages of size 5, searched for my threads, toggled to second page, no exception. Used DarkConsole to examine that second-page query, saw that it had `thread.id` explicitly instead of `id` implicitly. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11113 Differential Revision: https://secure.phabricator.com/D16080
This commit is contained in:
parent
c71f92a1eb
commit
a653d4d9b3
1 changed files with 10 additions and 6 deletions
|
@ -100,7 +100,7 @@ final class ConpherenceThreadQuery
|
|||
|
||||
$data = queryfx_all(
|
||||
$conn_r,
|
||||
'SELECT conpherence_thread.* FROM %T conpherence_thread %Q %Q %Q %Q %Q',
|
||||
'SELECT thread.* FROM %T thread %Q %Q %Q %Q %Q',
|
||||
$table->getTableName(),
|
||||
$this->buildJoinClause($conn_r),
|
||||
$this->buildWhereClause($conn_r),
|
||||
|
@ -144,7 +144,7 @@ final class ConpherenceThreadQuery
|
|||
|
||||
protected function buildGroupClause(AphrontDatabaseConnection $conn_r) {
|
||||
if ($this->participantPHIDs !== null || strlen($this->fulltext)) {
|
||||
return 'GROUP BY conpherence_thread.id';
|
||||
return 'GROUP BY thread.id';
|
||||
} else {
|
||||
return $this->buildApplicationSearchGroupClause($conn_r);
|
||||
}
|
||||
|
@ -156,14 +156,14 @@ final class ConpherenceThreadQuery
|
|||
if ($this->participantPHIDs !== null) {
|
||||
$joins[] = qsprintf(
|
||||
$conn_r,
|
||||
'JOIN %T p ON p.conpherencePHID = conpherence_thread.phid',
|
||||
'JOIN %T p ON p.conpherencePHID = thread.phid',
|
||||
id(new ConpherenceParticipant())->getTableName());
|
||||
}
|
||||
|
||||
if (strlen($this->fulltext)) {
|
||||
$joins[] = qsprintf(
|
||||
$conn_r,
|
||||
'JOIN %T idx ON idx.threadPHID = conpherence_thread.phid',
|
||||
'JOIN %T idx ON idx.threadPHID = thread.phid',
|
||||
id(new ConpherenceIndex())->getTableName());
|
||||
}
|
||||
|
||||
|
@ -179,14 +179,14 @@ final class ConpherenceThreadQuery
|
|||
if ($this->ids !== null) {
|
||||
$where[] = qsprintf(
|
||||
$conn_r,
|
||||
'conpherence_thread.id IN (%Ld)',
|
||||
'thread.id IN (%Ld)',
|
||||
$this->ids);
|
||||
}
|
||||
|
||||
if ($this->phids !== null) {
|
||||
$where[] = qsprintf(
|
||||
$conn_r,
|
||||
'conpherence_thread.phid IN (%Ls)',
|
||||
'thread.phid IN (%Ls)',
|
||||
$this->phids);
|
||||
}
|
||||
|
||||
|
@ -438,4 +438,8 @@ final class ConpherenceThreadQuery
|
|||
return 'PhabricatorConpherenceApplication';
|
||||
}
|
||||
|
||||
protected function getPrimaryTableAlias() {
|
||||
return 'thread';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue