From 5ce433074c971b47249b2e0d1031fccb97c8c1fe Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 2 Jul 2015 14:24:07 -0700 Subject: [PATCH] Fix a couple of minor Nuance / transaction publisher issues Summary: I got a couple of tasks stuck in my local queue a while ago when touching Nuance, fix a couple minor issues to clean them up. Test Plan: Ran tasks in queue, got clean results. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D13532 --- src/__phutil_library_map__.php | 1 + .../nuance/query/NuanceRequestorQuery.php | 33 +++++++------------ .../nuance/storage/NuanceItem.php | 27 ++++++++++++++- 3 files changed, 39 insertions(+), 22 deletions(-) diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index e4c1d337e6..23d2562822 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -4663,6 +4663,7 @@ phutil_register_library_map(array( 'NuanceItem' => array( 'NuanceDAO', 'PhabricatorPolicyInterface', + 'PhabricatorApplicationTransactionInterface', ), 'NuanceItemEditController' => 'NuanceController', 'NuanceItemEditor' => 'PhabricatorApplicationTransactionEditor', diff --git a/src/applications/nuance/query/NuanceRequestorQuery.php b/src/applications/nuance/query/NuanceRequestorQuery.php index 91a9878b83..49e4e61e94 100644 --- a/src/applications/nuance/query/NuanceRequestorQuery.php +++ b/src/applications/nuance/query/NuanceRequestorQuery.php @@ -16,41 +16,32 @@ final class NuanceRequestorQuery return $this; } - protected function loadPage() { - $table = new NuanceRequestor(); - $conn_r = $table->establishConnection('r'); - - $data = queryfx_all( - $conn_r, - 'SELECT FROM %T %Q %Q %Q', - $table->getTableName(), - $this->buildWhereClause($conn_r), - $this->buildOrderClause($conn_r), - $this->buildLimitClause($conn_r)); - - return $table->loadAllFromArray($data); + public function newObject() { + return new NuanceRequestor(); } - protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { - $where = array(); + protected function loadPage() { + return $this->loadStandardPage($this->newObject()); + } - $where[] = $this->buildPagingClause($conn_r); + protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { + $where = parent::buildWhereClauseParts($conn); - if ($this->ids) { + if ($this->ids !== null) { $where[] = qsprintf( - $conn_r, + $conn, 'id IN (%Ld)', $this->ids); } - if ($this->phids) { + if ($this->phids !== null) { $where[] = qsprintf( - $conn_r, + $conn, 'phid IN (%Ls)', $this->phids); } - return $this->formatWhereClause($where); + return $where; } } diff --git a/src/applications/nuance/storage/NuanceItem.php b/src/applications/nuance/storage/NuanceItem.php index 3e9f7617f9..196afc44ca 100644 --- a/src/applications/nuance/storage/NuanceItem.php +++ b/src/applications/nuance/storage/NuanceItem.php @@ -2,7 +2,9 @@ final class NuanceItem extends NuanceDAO - implements PhabricatorPolicyInterface { + implements + PhabricatorPolicyInterface, + PhabricatorApplicationTransactionInterface { const STATUS_OPEN = 0; const STATUS_ASSIGNED = 10; @@ -143,4 +145,27 @@ final class NuanceItem 'dateNuanced' => $this->getDateNuanced(), ); } + + +/* -( PhabricatorApplicationTransactionInterface )------------------------- */ + + + public function getApplicationTransactionEditor() { + return new NuanceItemEditor(); + } + + public function getApplicationTransactionObject() { + return $this; + } + + public function getApplicationTransactionTemplate() { + return new NuanceItemTransaction(); + } + + public function willRenderTimeline( + PhabricatorApplicationTransactionView $timeline, + AphrontRequest $request) { + return $timeline; + } + }