From efd59322f23e9db40d4702f78b45240325b7b896 Mon Sep 17 00:00:00 2001 From: vrana Date: Tue, 4 Sep 2012 19:22:03 -0700 Subject: [PATCH] Display 'away date' in blame Summary: I've done D3432 in the hope that it will fix also this... Test Plan: Blamed sporadic author. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3433 --- .../controller/DiffusionBrowseFileController.php | 1 + .../query/filecontent/DiffusionFileContentQuery.php | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/applications/diffusion/controller/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/DiffusionBrowseFileController.php index 18da351575..11807c1928 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseFileController.php @@ -52,6 +52,7 @@ final class DiffusionBrowseFileController extends DiffusionController { $file_query = DiffusionFileContentQuery::newFromDiffusionRequest( $this->diffusionRequest); + $file_query->setViewer($request->getUser()); $file_query->setNeedsBlame($needs_blame); $file_query->loadFileContent(); $data = $file_query->getRawData(); diff --git a/src/applications/diffusion/query/filecontent/DiffusionFileContentQuery.php b/src/applications/diffusion/query/filecontent/DiffusionFileContentQuery.php index 4ac6169f4e..0e28b1587e 100644 --- a/src/applications/diffusion/query/filecontent/DiffusionFileContentQuery.php +++ b/src/applications/diffusion/query/filecontent/DiffusionFileContentQuery.php @@ -20,6 +20,7 @@ abstract class DiffusionFileContentQuery extends DiffusionQuery { private $needsBlame; private $fileContent; + private $viewer; final public static function newFromDiffusionRequest( DiffusionRequest $request) { @@ -99,8 +100,11 @@ abstract class DiffusionFileContentQuery extends DiffusionQuery { $phids[] = $data->getCommitDetail('authorPHID'); } - $handles = id(new PhabricatorObjectHandleData(array_unique($phids))) - ->loadHandles(); + $loader = new PhabricatorObjectHandleData(array_unique($phids)); + if ($this->viewer) { + $loader->setViewer($this->viewer); + } + $handles = $loader->loadHandles(); foreach ($commits_data as $data) { if ($data->getCommitDetail('authorPHID')) { @@ -126,6 +130,11 @@ abstract class DiffusionFileContentQuery extends DiffusionQuery { return $this->needsBlame; } + public function setViewer(PhabricatorUser $user) { + $this->viewer = $user; + return $this; + } + protected function processRevList(array $rev_list) { return $rev_list; }