@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
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Slightly modernize NuanceQueue

Summary: Ref T8434. Touch things up a bit. This also cleans up the missing ApplicationTransactionInterface for T6367.

Test Plan: Didn't create a new queue. Didn't edit an existing queue.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: jeremyb, epriestley

Maniphest Tasks: T8434

Differential Revision: https://secure.phabricator.com/D13160

+67 -43
+20 -27
src/applications/nuance/controller/NuanceQueueEditController.php
··· 2 2 3 3 final class NuanceQueueEditController extends NuanceController { 4 4 5 - private $queueID; 6 - 7 - public function setQueueID($queue_id) { 8 - $this->queueID = $queue_id; 9 - return $this; 10 - } 11 - public function getQueueID() { 12 - return $this->queueID; 13 - } 14 - 15 - public function willProcessRequest(array $data) { 16 - $this->setQueueID(idx($data, 'id')); 17 - } 18 - 19 - public function processRequest() { 20 - $request = $this->getRequest(); 21 - $user = $request->getUser(); 5 + public function handleRequest(AphrontRequest $request) { 6 + $viewer = $this->getViewer(); 22 7 23 - $queue_id = $this->getQueueID(); 8 + $queue_id = $request->getURIData('id'); 24 9 $is_new = !$queue_id; 25 - 26 10 if ($is_new) { 27 - $queue = new NuanceQueue(); 28 - 11 + $queue = NuanceQueue::initializeNewQueue(); 29 12 } else { 30 13 $queue = id(new NuanceQueueQuery()) 31 - ->setViewer($user) 14 + ->setViewer($viewer) 32 15 ->withIDs(array($queue_id)) 33 16 ->executeOne(); 17 + if (!$queue) { 18 + return new Aphront404Response(); 19 + } 34 20 } 35 21 36 - if (!$queue) { 37 - return new Aphront404Response(); 22 + $crumbs = $this->buildApplicationCrumbs(); 23 + $crumbs->addTextCrumb( 24 + pht('Queues'), 25 + $this->getApplicationURI('queue/')); 26 + 27 + if ($is_new) { 28 + $title = pht('Create Queue'); 29 + $crumbs->addTextCrumb(pht('Create')); 30 + } else { 31 + $title = pht('Edit %s', $queue->getName()); 32 + $crumbs->addTextCrumb($queue->getName(), $queue->getURI()); 33 + $crumbs->addTextCrumb(pht('Edit')); 38 34 } 39 - 40 - $crumbs = $this->buildApplicationCrumbs(); 41 - $title = 'TODO'; 42 35 43 36 return $this->buildApplicationPage( 44 37 $crumbs,
+14 -15
src/applications/nuance/query/NuanceQueueQuery.php
··· 18 18 19 19 protected function loadPage() { 20 20 $table = new NuanceQueue(); 21 - $conn_r = $table->establishConnection('r'); 21 + $conn = $table->establishConnection('r'); 22 22 23 23 $data = queryfx_all( 24 - $conn_r, 25 - 'SELECT FROM %T %Q %Q %Q', 24 + $conn, 25 + '%Q FROM %T %Q %Q %Q', 26 + $this->buildSelectClause($conn), 26 27 $table->getTableName(), 27 - $this->buildWhereClause($conn_r), 28 - $this->buildOrderClause($conn_r), 29 - $this->buildLimitClause($conn_r)); 28 + $this->buildWhereClause($conn), 29 + $this->buildOrderClause($conn), 30 + $this->buildLimitClause($conn)); 30 31 31 32 return $table->loadAllFromArray($data); 32 33 } 33 34 34 - protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 35 - $where = array(); 35 + protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { 36 + $where = parent::buildWhereClauseParts($conn); 36 37 37 - $where[] = $this->buildPagingClause($conn_r); 38 - 39 - if ($this->ids) { 38 + if ($this->ids !== null) { 40 39 $where[] = qsprintf( 41 - $conn_r, 40 + $conn, 42 41 'id IN (%Ld)', 43 42 $this->ids); 44 43 } 45 44 46 - if ($this->phids) { 45 + if ($this->phids !== null) { 47 46 $where[] = qsprintf( 48 - $conn_r, 47 + $conn, 49 48 'phid IN (%Ls)', 50 49 $this->phids); 51 50 } 52 51 53 - return $this->formatWhereClause($where); 52 + return $where; 54 53 } 55 54 56 55 }
+33 -1
src/applications/nuance/storage/NuanceQueue.php
··· 2 2 3 3 final class NuanceQueue 4 4 extends NuanceDAO 5 - implements PhabricatorPolicyInterface { 5 + implements 6 + PhabricatorPolicyInterface, 7 + PhabricatorApplicationTransactionInterface { 6 8 7 9 protected $name; 8 10 protected $mailKey; ··· 24 26 NuanceQueuePHIDType::TYPECONST); 25 27 } 26 28 29 + public static function initializeNewQueue() { 30 + return new NuanceQueue(); 31 + } 32 + 27 33 public function save() { 28 34 if (!$this->getMailKey()) { 29 35 $this->setMailKey(Filesystem::readRandomCharacters(20)); ··· 35 41 return '/nuance/queue/view/'.$this->getID().'/'; 36 42 } 37 43 44 + 45 + /* -( PhabricatorPolicyInterface )----------------------------------------- */ 46 + 47 + 38 48 public function getCapabilities() { 39 49 return array( 40 50 PhabricatorPolicyCapability::CAN_VIEW, ··· 57 67 58 68 public function describeAutomaticCapability($capability) { 59 69 return null; 70 + } 71 + 72 + 73 + /* -( PhabricatorApplicationTransactionInterface )------------------------- */ 74 + 75 + 76 + public function getApplicationTransactionEditor() { 77 + return new NuanceQueueEditor(); 78 + } 79 + 80 + public function getApplicationTransactionObject() { 81 + return $this; 82 + } 83 + 84 + public function getApplicationTransactionTemplate() { 85 + return new NuanceQueueTransaction(); 86 + } 87 + 88 + public function willRenderTimeline( 89 + PhabricatorApplicationTransactionView $timeline, 90 + AphrontRequest $request) { 91 + return $timeline; 60 92 } 61 93 62 94 }