1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 19:40:55 +01: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 $phids;
private $ids; private $ids;
private $isRoom;
private $needWidgetData; private $needWidgetData;
private $needTransactions; private $needTransactions;
private $needParticipantCache; private $needParticipantCache;
@ -45,6 +46,11 @@ final class ConpherenceThreadQuery
return $this; return $this;
} }
public function withIsRoom($bool) {
$this->isRoom = $bool;
return $this;
}
public function setAfterTransactionID($id) { public function setAfterTransactionID($id) {
$this->afterTransactionID = $id; $this->afterTransactionID = $id;
return $this; return $this;
@ -105,20 +111,27 @@ final class ConpherenceThreadQuery
$where[] = $this->buildPagingClause($conn_r); $where[] = $this->buildPagingClause($conn_r);
if ($this->ids) { if ($this->ids !== null) {
$where[] = qsprintf( $where[] = qsprintf(
$conn_r, $conn_r,
'id IN (%Ld)', 'id IN (%Ld)',
$this->ids); $this->ids);
} }
if ($this->phids) { if ($this->phids !== null) {
$where[] = qsprintf( $where[] = qsprintf(
$conn_r, $conn_r,
'phid IN (%Ls)', 'phid IN (%Ls)',
$this->phids); $this->phids);
} }
if ($this->isRoom !== null) {
$where[] = qsprintf(
$conn_r,
'isRoom = %d',
(int)$this->isRoom);
}
return $this->formatWhereClause($where); return $this->formatWhereClause($where);
} }

View file

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