diff --git a/src/applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php --- a/src/applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php +++ b/src/applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php @@ -190,15 +190,19 @@ } } + $last_writer = null; + $writer_epoch = null; if ($write_properties) { $writer_phid = idx($write_properties, 'userPHID'); - $last_writer = $viewer->renderHandle($writer_phid); + + if ($writer_phid) { + $last_writer = $viewer->renderHandle($writer_phid); + } $writer_epoch = idx($write_properties, 'epoch'); - $writer_epoch = phabricator_datetime($writer_epoch, $viewer); - } else { - $last_writer = null; - $writer_epoch = null; + if ($writer_epoch) { + $writer_epoch = phabricator_datetime($writer_epoch, $viewer); + } } $rows[] = array( diff --git a/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php b/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php --- a/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php +++ b/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php @@ -11,6 +11,7 @@ private $repository; private $viewer; + private $actingAsPHID; private $logger; private $clusterWriteLock; @@ -44,6 +45,23 @@ return $this; } + public function setActingAsPHID($acting_as_phid) { + $this->actingAsPHID = $acting_as_phid; + return $this; + } + + public function getActingAsPHID() { + return $this->actingAsPHID; + } + + private function getEffectiveActingAsPHID() { + if ($this->actingAsPHID) { + return $this->actingAsPHID; + } + + return $this->getViewer()->getPHID(); + } + /* -( Cluster Synchronization )-------------------------------------------- */ @@ -402,7 +420,7 @@ $repository_phid, $device_phid, array( - 'userPHID' => $viewer->getPHID(), + 'userPHID' => $this->getEffectiveActingAsPHID(), 'epoch' => PhabricatorTime::getNow(), 'devicePHID' => $device_phid, ), @@ -433,8 +451,6 @@ return; } - $viewer = $this->getViewer(); - $device = AlmanacKeys::getLiveDevice(); $device_phid = $device->getPHID();