1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Conpherence - add isRoom column to thread table

Summary: Fixes T7583. We also add `key_room`, which uses isRoom and dateModified since a very common view of rooms is going to be ordered by last updated.

Test Plan: made the conpherence view controller query specify `withIsRoom(true)` and `withIsRoom(false)`. The former made the controller correctly 404 while the latter had no change in functionality.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7583

Differential Revision: https://secure.phabricator.com/D12102
This commit is contained in:
Bob Trahan 2015-03-17 15:37:09 -07:00
parent 66075708d0
commit 9bda03dbce
4 changed files with 23 additions and 2 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_conpherence.conpherence_thread
ADD isRoom BOOL NOT NULL DEFAULT 0 AFTER title;

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_conpherence.conpherence_thread
ADD KEY `key_room` (isRoom, dateModified);

View file

@ -7,6 +7,7 @@ final class ConpherenceThreadQuery
private $phids;
private $ids;
private $isRoom;
private $needWidgetData;
private $needTransactions;
private $needParticipantCache;
@ -45,6 +46,11 @@ final class ConpherenceThreadQuery
return $this;
}
public function withIsRoom($bool) {
$this->isRoom = $bool;
return $this;
}
public function setAfterTransactionID($id) {
$this->afterTransactionID = $id;
return $this;
@ -105,20 +111,27 @@ final class ConpherenceThreadQuery
$where[] = $this->buildPagingClause($conn_r);
if ($this->ids) {
if ($this->ids !== null) {
$where[] = qsprintf(
$conn_r,
'id IN (%Ld)',
$this->ids);
}
if ($this->phids) {
if ($this->phids !== null) {
$where[] = qsprintf(
$conn_r,
'phid IN (%Ls)',
$this->phids);
}
if ($this->isRoom !== null) {
$where[] = qsprintf(
$conn_r,
'isRoom = %d',
(int)$this->isRoom);
}
return $this->formatWhereClause($where);
}

View file

@ -4,6 +4,7 @@ final class ConpherenceThread extends ConpherenceDAO
implements PhabricatorPolicyInterface {
protected $title;
protected $isRoom = 0;
protected $messageCount;
protected $recentParticipantPHIDs = array();
protected $mailKey;
@ -29,10 +30,13 @@ final class ConpherenceThread extends ConpherenceDAO
),
self::CONFIG_COLUMN_SCHEMA => array(
'title' => 'text255?',
'isRoom' => 'bool',
'messageCount' => 'uint64',
'mailKey' => 'text20',
),
self::CONFIG_KEY_SCHEMA => array(
'key_room' => array(
'columns' => array('isRoom', 'dateModified'),),
'key_phid' => null,
'phid' => array(
'columns' => array('phid'),