From d51ae49f61fd6c4ec00d4ce99b4d5aca55717ce2 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 30 Oct 2013 13:15:14 -0700 Subject: [PATCH] Clean up Diffusion dedicated tag table view Summary: Minor cleanup. Make the "imported" check less strict (we don't need owners or herald to show change status). Export the "imported" flag over Conduit. Test Plan: Viewed tag table. Viewed partially imported repositories. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D7455 --- .../DiffusionBranchTableController.php | 2 +- .../controller/DiffusionTagListController.php | 31 +++++++++---------- .../view/DiffusionHistoryTableView.php | 6 +++- .../storage/PhabricatorRepositoryCommit.php | 8 ++++- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/applications/diffusion/controller/DiffusionBranchTableController.php b/src/applications/diffusion/controller/DiffusionBranchTableController.php index 049be12b88..622e7080e2 100644 --- a/src/applications/diffusion/controller/DiffusionBranchTableController.php +++ b/src/applications/diffusion/controller/DiffusionBranchTableController.php @@ -55,7 +55,7 @@ final class DiffusionBranchTableController extends DiffusionController { $crumbs = $this->buildCrumbs( array( - 'branches' => true, + 'branches' => true, )); return $this->buildApplicationPage( diff --git a/src/applications/diffusion/controller/DiffusionTagListController.php b/src/applications/diffusion/controller/DiffusionTagListController.php index bf86b679db..9daa82e70c 100644 --- a/src/applications/diffusion/controller/DiffusionTagListController.php +++ b/src/applications/diffusion/controller/DiffusionTagListController.php @@ -9,7 +9,7 @@ final class DiffusionTagListController extends DiffusionController { public function processRequest() { $drequest = $this->getDiffusionRequest(); $request = $this->getRequest(); - $user = $request->getUser(); + $viewer = $request->getUser(); $repository = $drequest->getRepository(); @@ -42,25 +42,22 @@ final class DiffusionTagListController extends DiffusionController { $content = null; if (!$tags) { - $content = new AphrontErrorView(); - $content->setTitle(pht('No Tags')); - if ($is_commit) { - $content->appendChild(pht('This commit has no tags.')); - } else { - $content->appendChild(pht('This repository has no tags.')); - } - $content->setSeverity(AphrontErrorView::SEVERITY_NODATA); + $content = $this->renderStatusMessage( + pht('No Tags'), + $is_commit + ? pht('This commit has no tags.') + : pht('This repository has no tags.')); } else { - $commits = id(new PhabricatorAuditCommitQuery()) - ->withIdentifiers( - $drequest->getRepository()->getID(), - mpull($tags, 'getCommitIdentifier')) + $commits = id(new DiffusionCommitQuery()) + ->setViewer($viewer) + ->withRepositoryIDs(array($repository->getID())) + ->withIdentifiers(mpull($tags, 'getCommitIdentifier')) ->needCommitData(true) ->execute(); $view = id(new DiffusionTagListView()) ->setTags($tags) - ->setUser($user) + ->setUser($viewer) ->setCommits($commits) ->setDiffusionRequest($drequest); @@ -78,8 +75,8 @@ final class DiffusionTagListController extends DiffusionController { $crumbs = $this->buildCrumbs( array( - 'tags' => true, - 'commit' => $drequest->getRawCommit(), + 'tags' => true, + 'commit' => $drequest->getRawCommit(), )); return $this->buildApplicationPage( @@ -89,7 +86,7 @@ final class DiffusionTagListController extends DiffusionController { ), array( 'title' => array( - 'Tags', + pht('Tags'), $repository->getCallsign().' Repository', ), )); diff --git a/src/applications/diffusion/view/DiffusionHistoryTableView.php b/src/applications/diffusion/view/DiffusionHistoryTableView.php index cc35e160a6..4023cafbb4 100644 --- a/src/applications/diffusion/view/DiffusionHistoryTableView.php +++ b/src/applications/diffusion/view/DiffusionHistoryTableView.php @@ -112,8 +112,12 @@ final class DiffusionHistoryTableView extends DiffusionView { $author = hsprintf('%s/%s', $author, $committer); } + // We can show details once the message and change have been imported. + $partial_import = PhabricatorRepositoryCommit::IMPORTED_MESSAGE | + PhabricatorRepositoryCommit::IMPORTED_CHANGE; + $commit = $history->getCommit(); - if ($commit && $commit->isImported() && $data) { + if ($commit && $commit->isPartiallyImported($partial_import) && $data) { $change = $this->linkChange( $history->getChangeType(), $history->getFileType(), diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommit.php b/src/applications/repository/storage/PhabricatorRepositoryCommit.php index d2a2518ccc..cdf7c585c0 100644 --- a/src/applications/repository/storage/PhabricatorRepositoryCommit.php +++ b/src/applications/repository/storage/PhabricatorRepositoryCommit.php @@ -36,6 +36,10 @@ final class PhabricatorRepositoryCommit return $this->assertAttached($this->repository); } + public function isPartiallyImported($mask) { + return (($mask & $this->getImportStatus()) == $mask); + } + public function isImported() { return ($this->getImportStatus() == self::IMPORTED_ALL); } @@ -218,7 +222,9 @@ final class PhabricatorRepositoryCommit 'mailKey' => $this->getMailKey(), 'authorPHID' => $this->getAuthorPHID(), 'auditStatus' => $this->getAuditStatus(), - 'summary' => $this->getSummary()); + 'summary' => $this->getSummary(), + 'importStatus' => $this->getImportStatus(), + ); } public static function newFromDictionary(array $dict) {