@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

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

+23 -2
+2
resources/sql/autopatches/20150317.conpherence.isroom.1.sql
··· 1 + ALTER TABLE {$NAMESPACE}_conpherence.conpherence_thread 2 + ADD isRoom BOOL NOT NULL DEFAULT 0 AFTER title;
+2
resources/sql/autopatches/20150317.conpherence.isroom.2.sql
··· 1 + ALTER TABLE {$NAMESPACE}_conpherence.conpherence_thread 2 + ADD KEY `key_room` (isRoom, dateModified);
+15 -2
src/applications/conpherence/query/ConpherenceThreadQuery.php
··· 7 7 8 8 private $phids; 9 9 private $ids; 10 + private $isRoom; 10 11 private $needWidgetData; 11 12 private $needTransactions; 12 13 private $needParticipantCache; ··· 42 43 43 44 public function withPHIDs(array $phids) { 44 45 $this->phids = $phids; 46 + return $this; 47 + } 48 + 49 + public function withIsRoom($bool) { 50 + $this->isRoom = $bool; 45 51 return $this; 46 52 } 47 53 ··· 105 111 106 112 $where[] = $this->buildPagingClause($conn_r); 107 113 108 - if ($this->ids) { 114 + if ($this->ids !== null) { 109 115 $where[] = qsprintf( 110 116 $conn_r, 111 117 'id IN (%Ld)', 112 118 $this->ids); 113 119 } 114 120 115 - if ($this->phids) { 121 + if ($this->phids !== null) { 116 122 $where[] = qsprintf( 117 123 $conn_r, 118 124 'phid IN (%Ls)', 119 125 $this->phids); 126 + } 127 + 128 + if ($this->isRoom !== null) { 129 + $where[] = qsprintf( 130 + $conn_r, 131 + 'isRoom = %d', 132 + (int)$this->isRoom); 120 133 } 121 134 122 135 return $this->formatWhereClause($where);
+4
src/applications/conpherence/storage/ConpherenceThread.php
··· 4 4 implements PhabricatorPolicyInterface { 5 5 6 6 protected $title; 7 + protected $isRoom = 0; 7 8 protected $messageCount; 8 9 protected $recentParticipantPHIDs = array(); 9 10 protected $mailKey; ··· 29 30 ), 30 31 self::CONFIG_COLUMN_SCHEMA => array( 31 32 'title' => 'text255?', 33 + 'isRoom' => 'bool', 32 34 'messageCount' => 'uint64', 33 35 'mailKey' => 'text20', 34 36 ), 35 37 self::CONFIG_KEY_SCHEMA => array( 38 + 'key_room' => array( 39 + 'columns' => array('isRoom', 'dateModified'),), 36 40 'key_phid' => null, 37 41 'phid' => array( 38 42 'columns' => array('phid'),