diff --git a/src/applications/diffusion/controller/DiffusionBrowseController.php b/src/applications/diffusion/controller/DiffusionBrowseController.php index 963840bf64..646acb2c39 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseController.php @@ -85,6 +85,7 @@ final class DiffusionBrowseController extends DiffusionController { $browse_table->setDiffusionRequest($drequest); $browse_table->setHandles($handles); $browse_table->setPaths($results); + $browse_table->setUser($this->getRequest()->getUser()); $browse_panel = new AphrontPanelView(); $browse_panel->appendChild($browse_table); diff --git a/src/applications/diffusion/controller/DiffusionRepositoryController.php b/src/applications/diffusion/controller/DiffusionRepositoryController.php index 5af5cc6bf6..ee373c5ccc 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryController.php @@ -93,6 +93,7 @@ final class DiffusionRepositoryController extends DiffusionController { $browse_table->setDiffusionRequest($drequest); $browse_table->setHandles($handles); $browse_table->setPaths($browse_results); + $browse_table->setUser($this->getRequest()->getUser()); $browse_panel = new AphrontPanelView(); $browse_panel->setHeader('Browse Repository'); diff --git a/src/applications/diffusion/view/DiffusionBrowseTableView.php b/src/applications/diffusion/view/DiffusionBrowseTableView.php index ecbf6e03ce..b185d8cd17 100644 --- a/src/applications/diffusion/view/DiffusionBrowseTableView.php +++ b/src/applications/diffusion/view/DiffusionBrowseTableView.php @@ -20,6 +20,7 @@ final class DiffusionBrowseTableView extends DiffusionView { private $paths; private $handles = array(); + private $user; public function setPaths(array $paths) { assert_instances_of($paths, 'DiffusionRepositoryPath'); @@ -46,6 +47,11 @@ final class DiffusionBrowseTableView extends DiffusionView { return phutil_escape_html($name); } + public function setUser(PhabricatorUser $user) { + $this->user = $user; + return $this; + } + public static function renderLastModifiedColumns( PhabricatorRepository $repository, array $handles, @@ -115,6 +121,7 @@ final class DiffusionBrowseTableView extends DiffusionView { $need_pull = array(); $rows = array(); + $show_edit = false; foreach ($this->paths as $path) { $dir_slash = null; @@ -184,8 +191,26 @@ final class DiffusionBrowseTableView extends DiffusionView { } } + $editor_button = ''; + if ($this->user) { + $editor_link = $this->user->loadEditorLink( + $base_path.$path->getPath(), + 1, + $request->getRepository()->getCallsign()); + if ($editor_link) { + $show_edit = true; + $editor_button = phutil_render_tag( + 'a', + array( + 'href' => $editor_link, + ), + 'Edit'); + } + } + $rows[] = array( $this->linkHistory($base_path.$path->getPath().$dir_slash), + $editor_button, $browse_link, $dict['commit'], $dict['date'], @@ -204,6 +229,7 @@ final class DiffusionBrowseTableView extends DiffusionView { $view->setHeaders( array( 'History', + 'Edit', 'Path', 'Modified', 'Date', @@ -218,11 +244,24 @@ final class DiffusionBrowseTableView extends DiffusionView { '', '', '', + '', 'right', '', '', 'wide', )); + $view->setColumnVisibility( + array( + true, + $show_edit, + true, + true, + true, + true, + true, + true, + true, + )); return $view->render(); }