1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-15 18:10:53 +01:00

(stable) Promote 2017 Week 27

This commit is contained in:
epriestley 2017-07-07 16:42:06 -07:00
commit eed68de999
20 changed files with 279 additions and 359 deletions

View file

@ -74,6 +74,7 @@ return array(
'rsrc/css/application/diffusion/diffusion-history.css' => '4540f568', 'rsrc/css/application/diffusion/diffusion-history.css' => '4540f568',
'rsrc/css/application/diffusion/diffusion-icons.css' => 'a6a1e2ba', 'rsrc/css/application/diffusion/diffusion-icons.css' => 'a6a1e2ba',
'rsrc/css/application/diffusion/diffusion-readme.css' => '419dd5b6', 'rsrc/css/application/diffusion/diffusion-readme.css' => '419dd5b6',
'rsrc/css/application/diffusion/diffusion-repository.css' => 'ee6f20ec',
'rsrc/css/application/diffusion/diffusion-source.css' => '750add59', 'rsrc/css/application/diffusion/diffusion-source.css' => '750add59',
'rsrc/css/application/feed/feed.css' => 'ecd4ec57', 'rsrc/css/application/feed/feed.css' => 'ecd4ec57',
'rsrc/css/application/files/global-drag-and-drop.css' => '5c1b47c2', 'rsrc/css/application/files/global-drag-and-drop.css' => '5c1b47c2',
@ -572,6 +573,7 @@ return array(
'diffusion-history-css' => '4540f568', 'diffusion-history-css' => '4540f568',
'diffusion-icons-css' => 'a6a1e2ba', 'diffusion-icons-css' => 'a6a1e2ba',
'diffusion-readme-css' => '419dd5b6', 'diffusion-readme-css' => '419dd5b6',
'diffusion-repository-css' => 'ee6f20ec',
'diffusion-source-css' => '750add59', 'diffusion-source-css' => '750add59',
'diviner-shared-css' => '896f1d43', 'diviner-shared-css' => '896f1d43',
'font-fontawesome' => 'e838e088', 'font-fontawesome' => 'e838e088',

View file

@ -71,8 +71,11 @@ final class DiffusionBranchTableController extends DiffusionController {
->setHeader(pht('Branches')) ->setHeader(pht('Branches'))
->setHeaderIcon('fa-code-fork'); ->setHeaderIcon('fa-code-fork');
$tabs = $this->buildTabsView('branch');
$view = id(new PHUITwoColumnView()) $view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setTabs($tabs)
->setFooter(array( ->setFooter(array(
$content, $content,
)); ));

View file

@ -106,7 +106,6 @@ final class DiffusionBrowseController extends DiffusionController {
$path = $drequest->getPath(); $path = $drequest->getPath();
$blame_key = PhabricatorDiffusionBlameSetting::SETTINGKEY; $blame_key = PhabricatorDiffusionBlameSetting::SETTINGKEY;
$show_blame = $request->getBool( $show_blame = $request->getBool(
'blame', 'blame',
$viewer->getUserSetting($blame_key)); $viewer->getUserSetting($blame_key));
@ -160,6 +159,7 @@ final class DiffusionBrowseController extends DiffusionController {
$hit_time_limit = $response['tooSlow']; $hit_time_limit = $response['tooSlow'];
$file_phid = $response['filePHID']; $file_phid = $response['filePHID'];
$show_editor = false;
if ($hit_byte_limit) { if ($hit_byte_limit) {
$corpus = $this->buildErrorCorpus( $corpus = $this->buildErrorCorpus(
pht( pht(
@ -215,6 +215,7 @@ final class DiffusionBrowseController extends DiffusionController {
} else { } else {
$this->loadLintMessages(); $this->loadLintMessages();
$this->coverage = $drequest->loadCoverage(); $this->coverage = $drequest->loadCoverage();
$show_editor = true;
// Build the content of the file. // Build the content of the file.
$corpus = $this->buildCorpus( $corpus = $this->buildCorpus(
@ -234,12 +235,7 @@ final class DiffusionBrowseController extends DiffusionController {
require_celerity_resource('diffusion-source-css'); require_celerity_resource('diffusion-source-css');
// Render the page. // Render the page.
$view = $this->buildCurtain($drequest); $curtain = $this->buildCurtain($drequest, $show_blame, $show_editor);
$curtain = $this->enrichCurtain(
$view,
$drequest,
$show_blame);
$properties = $this->buildPropertyView($drequest); $properties = $this->buildPropertyView($drequest);
$header = $this->buildHeaderView($drequest); $header = $this->buildHeaderView($drequest);
$header->setHeaderIcon('fa-file-code-o'); $header->setHeaderIcon('fa-file-code-o');
@ -327,7 +323,7 @@ final class DiffusionBrowseController extends DiffusionController {
$reason = $results->getReasonForEmptyResultSet(); $reason = $results->getReasonForEmptyResultSet();
$curtain = $this->buildCurtain($drequest); $actions = $this->getActions($drequest);
$details = $this->buildPropertyView($drequest); $details = $this->buildPropertyView($drequest);
$header = $this->buildHeaderView($drequest); $header = $this->buildHeaderView($drequest);
@ -363,9 +359,9 @@ final class DiffusionBrowseController extends DiffusionController {
->setPaths($results->getPaths()) ->setPaths($results->getPaths())
->setUser($request->getUser()); ->setUser($request->getUser());
$browse_header = id(new PHUIHeaderView()) $title = nonempty(basename($drequest->getPath()), '/');
->setHeader(nonempty(basename($drequest->getPath()), '/')) $icon = 'fa-folder-open';
->setHeaderIcon('fa-folder-open'); $browse_header = $this->buildPanelHeaderView($title, $icon, $actions);
$browse_panel = id(new PHUIObjectBoxView()) $browse_panel = id(new PHUIObjectBoxView())
->setHeader($browse_header) ->setHeader($browse_header)
@ -400,15 +396,11 @@ final class DiffusionBrowseController extends DiffusionController {
$view = id(new PHUITwoColumnView()) $view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setCurtain($curtain) ->setFooter(
->setMainColumn(
array( array(
$branch_panel, $branch_panel,
$empty_result, $empty_result,
$browse_panel, $browse_panel,
))
->setFooter(
array(
$open_revisions, $open_revisions,
$readme, $readme,
)); ));
@ -745,14 +737,14 @@ final class DiffusionBrowseController extends DiffusionController {
Javelin::initBehavior('load-blame', array('id' => $id)); Javelin::initBehavior('load-blame', array('id' => $id));
$edit = $this->renderEditButton();
$file = $this->renderFileButton(); $file = $this->renderFileButton();
$header = id(new PHUIHeaderView()) $title = basename($this->getDiffusionRequest()->getPath());
->setHeader(basename($this->getDiffusionRequest()->getPath())) $icon = 'fa-file-code-o';
->setHeaderIcon('fa-file-code-o') $drequest = $this->getDiffusionRequest();
->addActionLink($edit) $actions = $this->getActions($drequest);
->addActionLink($file);
$header = $this->buildPanelHeaderView($title, $icon, $actions);
$header->addActionLink($file);
$corpus = id(new PHUIObjectBoxView()) $corpus = id(new PHUIObjectBoxView())
->setHeader($header) ->setHeader($header)
@ -791,14 +783,23 @@ final class DiffusionBrowseController extends DiffusionController {
return $corpus; return $corpus;
} }
private function enrichCurtain( private function buildCurtain(
PHUICurtainView $curtain,
DiffusionRequest $drequest, DiffusionRequest $drequest,
$show_blame) { $show_blame,
$show_editor) {
$curtain = $this->newCurtainView($drequest);
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$base_uri = $this->getRequest()->getRequestURI(); $base_uri = $this->getRequest()->getRequestURI();
$user = $this->getRequest()->getUser();
$repository = $drequest->getRepository();
$path = $drequest->getPath();
$line = nonempty((int)$drequest->getLine(), 1);
$editor_link = $user->loadEditorLink($path, $line, $repository);
$template = $user->loadEditorLink($path, '%l', $repository);
$curtain->addAction( $curtain->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Show Last Change')) ->setName(pht('Show Last Change'))
@ -827,6 +828,15 @@ final class DiffusionBrowseController extends DiffusionController {
->setUser($viewer) ->setUser($viewer)
->setRenderAsForm($viewer->isLoggedIn())); ->setRenderAsForm($viewer->isLoggedIn()));
$curtain->addAction(
id(new PhabricatorActionView())
->setName(pht('Open in Editor'))
->setHref($editor_link)
->setIcon('fa-pencil')
->setID('editor_link')
->setMetadata(array('link_template' => $template))
->setDisabled(!$editor_link));
$href = null; $href = null;
if ($this->getRequest()->getStr('lint') !== null) { if ($this->getRequest()->getStr('lint') !== null) {
$lint_text = pht('Hide %d Lint Message(s)', count($this->lintMessages)); $lint_text = pht('Hide %d Lint Message(s)', count($this->lintMessages));
@ -897,41 +907,16 @@ final class DiffusionBrowseController extends DiffusionController {
return $curtain; return $curtain;
} }
private function renderEditButton() {
$request = $this->getRequest();
$user = $request->getUser();
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$path = $drequest->getPath();
$line = nonempty((int)$drequest->getLine(), 1);
$editor_link = $user->loadEditorLink($path, $line, $repository);
$template = $user->loadEditorLink($path, '%l', $repository);
$button = id(new PHUIButtonView())
->setTag('a')
->setText(pht('Open in Editor'))
->setHref($editor_link)
->setIcon('fa-pencil')
->setID('editor_link')
->setMetadata(array('link_template' => $template))
->setDisabled(!$editor_link);
return $button;
}
private function renderFileButton($file_uri = null, $label = null) { private function renderFileButton($file_uri = null, $label = null) {
$base_uri = $this->getRequest()->getRequestURI(); $base_uri = $this->getRequest()->getRequestURI();
if ($file_uri) { if ($file_uri) {
$text = pht('Download Raw File'); $text = pht('Download Raw');
$href = $file_uri; $href = $file_uri;
$icon = 'fa-download'; $icon = 'fa-download';
} else { } else {
$text = pht('View Raw File'); $text = pht('View Raw');
$href = $base_uri->alter('view', 'raw'); $href = $base_uri->alter('view', 'raw');
$icon = 'fa-file-text'; $icon = 'fa-file-text';
} }
@ -1374,10 +1359,12 @@ final class DiffusionBrowseController extends DiffusionController {
))); )));
$file = $this->renderFileButton($file_uri); $file = $this->renderFileButton($file_uri);
$header = id(new PHUIHeaderView()) $title = basename($this->getDiffusionRequest()->getPath());
->setHeader(basename($this->getDiffusionRequest()->getPath())) $icon = 'fa-file-image-o';
->addActionLink($file) $drequest = $this->getDiffusionRequest();
->setHeaderIcon('fa-file-image-o'); $actions = $this->getActions($drequest);
$header = $this->buildPanelHeaderView($title, $icon, $actions);
$header->addActionLink($file);
return id(new PHUIObjectBoxView()) return id(new PHUIObjectBoxView())
->setHeader($header) ->setHeader($header)
@ -1393,9 +1380,12 @@ final class DiffusionBrowseController extends DiffusionController {
->appendChild($text); ->appendChild($text);
$file = $this->renderFileButton($file_uri); $file = $this->renderFileButton($file_uri);
$header = id(new PHUIHeaderView()) $title = basename($this->getDiffusionRequest()->getPath());
->setHeader(pht('Details')) $icon = 'fa-file';
->addActionLink($file); $drequest = $this->getDiffusionRequest();
$actions = $this->getActions($drequest);
$header = $this->buildPanelHeaderView($title, $icon, $actions);
$header->addActionLink($file);
$box = id(new PHUIObjectBoxView()) $box = id(new PHUIObjectBoxView())
->setHeader($header) ->setHeader($header)
@ -1656,52 +1646,61 @@ final class DiffusionBrowseController extends DiffusionController {
return $header; return $header;
} }
protected function buildCurtain(DiffusionRequest $drequest) { protected function buildPanelHeaderView($title, $icon, array $actions) {
$header = id(new PHUIHeaderView())
->setHeader($title)
->setHeaderIcon($icon)
->addClass('diffusion-panel-header-view');
foreach ($actions as $action_link) {
if ($action_link) {
$header->addActionLink($action_link);
}
}
return $header;
}
protected function getActions(DiffusionRequest $drequest) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$repository = $drequest->getRepository(); $repository = $drequest->getRepository();
$history_uri = $drequest->generateURI(array('action' => 'history'));
$curtain = $this->newCurtainView($drequest);
$history_uri = $drequest->generateURI(
array(
'action' => 'history',
));
$curtain->addAction(
id(new PhabricatorActionView())
->setName(pht('View History'))
->setHref($history_uri)
->setIcon('fa-list'));
$behind_head = $drequest->getSymbolicCommit(); $behind_head = $drequest->getSymbolicCommit();
if ($repository->supportsBranchComparison()) {
$compare_uri = $drequest->generateURI(
array(
'action' => 'compare',
));
$curtain->addAction(
id(new PhabricatorActionView())
->setName(pht('Compare Against...'))
->setIcon('fa-code-fork')
->setWorkflow(true)
->setHref($compare_uri));
}
$head_uri = $drequest->generateURI( $head_uri = $drequest->generateURI(
array( array(
'commit' => '', 'commit' => '',
'action' => 'browse', 'action' => 'browse',
)); ));
$curtain->addAction(
id(new PhabricatorActionView()) if ($repository->supportsBranchComparison()) {
->setName(pht('Jump to HEAD')) $compare_uri = $drequest->generateURI(array('action' => 'compare'));
$compare = id(new PHUIButtonView())
->setText(pht('Compare'))
->setIcon('fa-code-fork')
->setWorkflow(true)
->setTag('a')
->setHref($compare_uri)
->setColor(PHUIButtonView::GREY);
}
$head = null;
if ($behind_head) {
$head = id(new PHUIButtonView())
->setText(pht('Back to HEAD'))
->setHref($head_uri) ->setHref($head_uri)
->setIcon('fa-home') ->setIcon('fa-home')
->setDisabled(!$behind_head)); ->setColor(PHUIButtonView::GREY);
}
return $curtain; $history = id(new PHUIButtonView())
->setText(pht('History'))
->setHref($history_uri)
->setTag('a')
->setIcon('fa-history')
->setColor(PHUIButtonView::GREY);
return array($history, $compare, $head);
} }
protected function buildPropertyView( protected function buildPropertyView(
@ -1902,9 +1901,11 @@ final class DiffusionBrowseController extends DiffusionController {
// show the user an error if we can't, rather than making them click // show the user an error if we can't, rather than making them click
// through to hit an error. // through to hit an error.
$header = id(new PHUIHeaderView()) $title = basename($this->getDiffusionRequest()->getPath());
->setHeader(basename($this->getDiffusionRequest()->getPath())) $icon = 'fa-archive';
->setHeaderIcon('fa-archive'); $drequest = $this->getDiffusionRequest();
$actions = $this->getActions($drequest);
$header = $this->buildPanelHeaderView($title, $icon, $actions);
$severity = PHUIInfoView::SEVERITY_NOTICE; $severity = PHUIInfoView::SEVERITY_NOTICE;

View file

@ -44,6 +44,7 @@ abstract class DiffusionController extends PhabricatorController {
private function loadContext(array $options) { private function loadContext(array $options) {
$request = $this->getRequest(); $request = $this->getRequest();
$viewer = $this->getViewer(); $viewer = $this->getViewer();
require_celerity_resource('diffusion-repository-css');
$identifier = $this->getRepositoryIdentifierFromRequest($request); $identifier = $this->getRepositoryIdentifierFromRequest($request);
@ -122,10 +123,10 @@ abstract class DiffusionController extends PhabricatorController {
private function buildCrumbList(array $spec = array()) { private function buildCrumbList(array $spec = array()) {
$spec = $spec + array( $spec = $spec + array(
'commit' => null, 'commit' => null,
'tags' => null, 'tags' => null,
'branches' => null, 'branches' => null,
'view' => null, 'view' => null,
); );
$crumb_list = array(); $crumb_list = array();
@ -314,7 +315,7 @@ abstract class DiffusionController extends PhabricatorController {
protected function renderStatusMessage($title, $body) { protected function renderStatusMessage($title, $body) {
return id(new PHUIInfoView()) return id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_WARNING) ->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
->setTitle($title) ->setTitle($title)
->setFlush(true) ->setFlush(true)
->appendChild($body); ->appendChild($body);
@ -409,4 +410,74 @@ abstract class DiffusionController extends PhabricatorController {
->setContent($readme_corpus); ->setContent($readme_corpus);
} }
protected function buildTabsView($key) {
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
$view = new PHUIListView();
$view->addMenuItem(
id(new PHUIListItemView())
->setKey('home')
->setName(pht('Home'))
->setIcon('fa-home')
->setHref($drequest->generateURI(
array(
'action' => 'branch',
'path' => '/',
)))
->setSelected($key == 'home'));
if (!$repository->isSVN()) {
$view->addMenuItem(
id(new PHUIListItemView())
->setKey('branch')
->setName(pht('Branches'))
->setIcon('fa-code-fork')
->setHref($drequest->generateURI(
array(
'action' => 'branches',
)))
->setSelected($key == 'branch'));
}
if (!$repository->isSVN()) {
$view->addMenuItem(
id(new PHUIListItemView())
->setKey('tags')
->setName(pht('Tags'))
->setIcon('fa-tags')
->setHref($drequest->generateURI(
array(
'action' => 'tags',
)))
->setSelected($key == 'tags'));
}
$view->addMenuItem(
id(new PHUIListItemView())
->setKey('history')
->setName(pht('History'))
->setIcon('fa-history')
->setHref($drequest->generateURI(
array(
'action' => 'history',
)))
->setSelected($key == 'history'));
$view->addMenuItem(
id(new PHUIListItemView())
->setKey('graph')
->setName(pht('Graph'))
->setIcon('fa-code-fork')
->setHref($drequest->generateURI(
array(
'action' => 'graph',
)))
->setSelected($key == 'graph'));
return $view;
}
} }

View file

@ -68,8 +68,11 @@ final class DiffusionGraphController extends DiffusionController {
->setTable($graph) ->setTable($graph)
->setPager($pager); ->setPager($pager);
$tabs = $this->buildTabsView('graph');
$view = id(new PHUITwoColumnView()) $view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setTabs($tabs)
->setFooter($graph_view); ->setFooter($graph_view);
return $this->newPage() return $this->newPage()
@ -81,25 +84,17 @@ final class DiffusionGraphController extends DiffusionController {
private function buildHeader(DiffusionRequest $drequest) { private function buildHeader(DiffusionRequest $drequest) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$tag = $this->renderCommitHashTag($drequest); $no_path = !strlen($drequest->getPath());
$history_uri = $drequest->generateURI( if ($no_path) {
array( $header_text = pht('Graph');
'action' => 'history', } else {
)); $header_text = $this->renderPathLinks($drequest, $mode = 'history');
}
$history_button = id(new PHUIButtonView())
->setTag('a')
->setText(pht('History'))
->setHref($history_uri)
->setIcon('fa-history');
$header = id(new PHUIHeaderView()) $header = id(new PHUIHeaderView())
->setUser($viewer) ->setUser($viewer)
->setPolicyObject($drequest->getRepository()) ->setHeader($header_text)
->addTag($tag) ->setHeaderIcon('fa-code-fork');
->setHeader($this->renderPathLinks($drequest, $mode = 'history'))
->setHeaderIcon('fa-code-fork')
->addActionLink($history_button);
return $header; return $header;

View file

@ -59,8 +59,11 @@ final class DiffusionHistoryController extends DiffusionController {
->addClass('mlb') ->addClass('mlb')
->appendChild($pager); ->appendChild($pager);
$tabs = $this->buildTabsView('history');
$view = id(new PHUITwoColumnView()) $view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setTabs($tabs)
->setFooter(array( ->setFooter(array(
$history_list, $history_list,
$pager, $pager,
@ -76,30 +79,18 @@ final class DiffusionHistoryController extends DiffusionController {
private function buildHeader(DiffusionRequest $drequest) { private function buildHeader(DiffusionRequest $drequest) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$tag = $this->renderCommitHashTag($drequest); $no_path = !strlen($drequest->getPath());
$show_graph = !strlen($drequest->getPath()); if ($no_path) {
$header_text = pht('History');
} else {
$header_text = $this->renderPathLinks($drequest, $mode = 'history');
}
$header = id(new PHUIHeaderView()) $header = id(new PHUIHeaderView())
->setUser($viewer) ->setUser($viewer)
->setPolicyObject($drequest->getRepository()) ->setHeader($header_text)
->addTag($tag)
->setHeader($this->renderPathLinks($drequest, $mode = 'history'))
->setHeaderIcon('fa-clock-o'); ->setHeaderIcon('fa-clock-o');
if ($show_graph) {
$graph_uri = $drequest->generateURI(
array(
'action' => 'graph',
));
$graph_button = id(new PHUIButtonView())
->setTag('a')
->setText(pht('Graph'))
->setHref($graph_uri)
->setIcon('fa-code-fork');
$header->addActionLink($graph_button);
}
return $header; return $header;
} }

View file

@ -84,9 +84,12 @@ final class DiffusionRepositoryController extends DiffusionController {
->setErrors(array($empty_message)); ->setErrors(array($empty_message));
} }
$tabs = $this->buildTabsView('home');
$view = id(new PHUITwoColumnView()) $view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setCurtain($curtain) ->setCurtain($curtain)
->setTabs($tabs)
->setMainColumn(array( ->setMainColumn(array(
$property_table, $property_table,
$description, $description,
@ -134,32 +137,9 @@ final class DiffusionRepositoryController extends DiffusionController {
'limit' => $browse_pager->getPageSize() + 1, 'limit' => $browse_pager->getPageSize() + 1,
)); ));
if ($this->needTagFuture()) {
$tag_limit = $this->getTagLimit();
$this->tagFuture = $this->callConduitMethod(
'diffusion.tagsquery',
array(
// On the home page, we want to find tags on any branch.
'commit' => null,
'limit' => $tag_limit + 1,
));
}
if ($this->needBranchFuture()) {
$branch_limit = $this->getBranchLimit();
$this->branchFuture = $this->callConduitMethod(
'diffusion.branchquery',
array(
'closed' => false,
'limit' => $branch_limit + 1,
));
}
$futures = array( $futures = array(
$this->historyFuture, $this->historyFuture,
$this->browseFuture, $this->browseFuture,
$this->tagFuture,
$this->branchFuture,
); );
$futures = array_filter($futures); $futures = array_filter($futures);
$futures = new FutureIterator($futures); $futures = new FutureIterator($futures);
@ -241,26 +221,6 @@ final class DiffusionRepositoryController extends DiffusionController {
$history, $history,
$history_exception); $history_exception);
try {
$content[] = $this->buildTagListTable($drequest);
} catch (Exception $ex) {
if (!$repository->isImporting()) {
$content[] = $this->renderStatusMessage(
pht('Unable to Load Tags'),
$ex->getMessage());
}
}
try {
$content[] = $this->buildBranchListTable($drequest);
} catch (Exception $ex) {
if (!$repository->isImporting()) {
$content[] = $this->renderStatusMessage(
pht('Unable to Load Branches'),
$ex->getMessage());
}
}
if ($readme) { if ($readme) {
$content[] = $readme; $content[] = $readme;
} }
@ -366,6 +326,12 @@ final class DiffusionRepositoryController extends DiffusionController {
$this->renderCloneURI($repository, $uri)); $this->renderCloneURI($repository, $uri));
} }
if (!$view->hasAnyProperties()) {
$view = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
->appendChild(pht('Repository has no URIs set.'));
}
$box = id(new PHUIObjectBoxView()) $box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Details')) ->setHeaderText(pht('Details'))
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
@ -412,123 +378,6 @@ final class DiffusionRepositoryController extends DiffusionController {
return $box; return $box;
} }
private function buildBranchListTable(DiffusionRequest $drequest) {
$viewer = $this->getViewer();
if (!$this->needBranchFuture()) {
return null;
}
$branches = $this->branchFuture->resolve();
if (!$branches) {
return null;
}
$limit = $this->getBranchLimit();
$more_branches = (count($branches) > $limit);
$branches = array_slice($branches, 0, $limit);
$branches = DiffusionRepositoryRef::loadAllFromDictionaries($branches);
$commits = id(new DiffusionCommitQuery())
->setViewer($viewer)
->withIdentifiers(mpull($branches, 'getCommitIdentifier'))
->withRepository($drequest->getRepository())
->execute();
$table = id(new DiffusionBranchTableView())
->setUser($viewer)
->setDiffusionRequest($drequest)
->setBranches($branches)
->setCommits($commits);
$panel = id(new PHUIObjectBoxView())
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY);
$header = new PHUIHeaderView();
$header->setHeader(pht('Branches'));
if ($more_branches) {
$header->setSubheader(pht('Showing %d branches.', $limit));
}
$button = id(new PHUIButtonView())
->setText(pht('Show All'))
->setTag('a')
->setIcon('fa-code-fork')
->setHref($drequest->generateURI(
array(
'action' => 'branches',
)));
$header->addActionLink($button);
$panel->setHeader($header);
$panel->setTable($table);
return $panel;
}
private function buildTagListTable(DiffusionRequest $drequest) {
$viewer = $this->getViewer();
$repository = $drequest->getRepository();
if (!$this->needTagFuture()) {
return null;
}
$tags = $this->tagFuture->resolve();
$tags = DiffusionRepositoryTag::newFromConduit($tags);
if (!$tags) {
return null;
}
$tag_limit = $this->getTagLimit();
$more_tags = (count($tags) > $tag_limit);
$tags = array_slice($tags, 0, $tag_limit);
$commits = id(new DiffusionCommitQuery())
->setViewer($viewer)
->withIdentifiers(mpull($tags, 'getCommitIdentifier'))
->withRepository($repository)
->needCommitData(true)
->execute();
$view = id(new DiffusionTagTableView())
->setUser($viewer)
->setDiffusionRequest($drequest)
->setTags($tags)
->setCommits($commits);
$phids = $view->getRequiredHandlePHIDs();
$handles = $this->loadViewerHandles($phids);
$view->setHandles($handles);
$panel = new PHUIObjectBoxView();
$header = new PHUIHeaderView();
$header->setHeader(pht('Tags'));
if ($more_tags) {
$header->setSubheader(
pht('Showing the %d most recent tags.', $tag_limit));
}
$button = id(new PHUIButtonView())
->setText(pht('Show All Tags'))
->setTag('a')
->setIcon('fa-tag')
->setHref($drequest->generateURI(
array(
'action' => 'tags',
)));
$header->addActionLink($button);
$panel->setHeader($header);
$panel->setTable($view);
$panel->setBackground(PHUIObjectBoxView::BLUE_PROPERTY);
return $panel;
}
private function buildHistoryTable( private function buildHistoryTable(
$history_results, $history_results,
$history, $history,
@ -567,30 +416,10 @@ final class DiffusionRepositoryController extends DiffusionController {
$history_table->setIsHead(true); $history_table->setIsHead(true);
$history = id(new PHUIButtonView())
->setText(pht('History'))
->setHref($drequest->generateURI(
array(
'action' => 'history',
)))
->setTag('a')
->setIcon('fa-history');
$graph = id(new PHUIButtonView())
->setText(pht('Graph'))
->setHref($drequest->generateURI(
array(
'action' => 'graph',
)))
->setTag('a')
->setIcon('fa-code-fork');
$panel = id(new PHUIObjectBoxView()) $panel = id(new PHUIObjectBoxView())
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY); ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY);
$header = id(new PHUIHeaderView()) $header = id(new PHUIHeaderView())
->setHeader(pht('Recent Commits')) ->setHeader(pht('Recent Commits'));
->addActionLink($graph)
->addActionLink($history);
$panel->setHeader($header); $panel->setHeader($header);
$panel->setTable($history_table); $panel->setTable($history_table);
@ -721,35 +550,8 @@ final class DiffusionRepositoryController extends DiffusionController {
->setDisplayURI($display); ->setDisplayURI($display);
} }
private function needTagFuture() {
$drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository();
switch ($repository->getVersionControlSystem()) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
// No tags in SVN.
return false;
}
return true;
}
private function getTagLimit() { private function getTagLimit() {
return 15; return 15;
} }
private function needBranchFuture() {
$drequest = $this->getDiffusionRequest();
if ($drequest->getBranch() === null) {
return false;
}
return true;
}
private function getBranchLimit() {
return 15;
}
} }

View file

@ -88,8 +88,11 @@ final class DiffusionTagListController extends DiffusionController {
)); ));
$crumbs->setBorder(true); $crumbs->setBorder(true);
$tabs = $this->buildTabsView('tags');
$view = id(new PHUITwoColumnView()) $view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setTabs($tabs)
->setFooter($content); ->setFooter($content);
return $this->newPage() return $this->newPage()

View file

@ -54,7 +54,7 @@ final class DiffusionRepositoryDatasource
$parts[] = $monogram; $parts[] = $monogram;
} }
$name = implode(' ', $parts); $name = implode("\n", $parts);
$vcs = $repository->getVersionControlSystem(); $vcs = $repository->getVersionControlSystem();
$vcs_type = PhabricatorRepositoryType::getNameForRepositoryType($vcs); $vcs_type = PhabricatorRepositoryType::getNameForRepositoryType($vcs);

View file

@ -98,8 +98,12 @@ final class DiffusionReadmeView extends DiffusionView {
->setFluid(true) ->setFluid(true)
->appendChild($readme_content); ->appendChild($readme_content);
$header = id(new PHUIHeaderView())
->setHeader($readme_name)
->addClass('diffusion-panel-header-view');
return id(new PHUIObjectBoxView()) return id(new PHUIObjectBoxView())
->setHeaderText($readme_name) ->setHeader($header)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->appendChild($document) ->appendChild($document)
->addClass('diffusion-readme-view'); ->addClass('diffusion-readme-view');

View file

@ -42,8 +42,9 @@ final class PhamePostArchiveController extends PhamePostController {
$title = pht('Archive Post'); $title = pht('Archive Post');
$body = pht( $body = pht(
'This post will revert to archived status and no longer be visible '. 'If you archive this post, it will only be visible to users who can '.
'to other users or members of this blog.'); 'edit %s.',
$viewer->renderHandle($post->getBlogPHID()));
$button = pht('Archive Post'); $button = pht('Archive Post');
return $this->newDialog() return $this->newDialog()

View file

@ -46,8 +46,10 @@ final class PhamePostViewController
->setSeverity(PHUIInfoView::SEVERITY_NOTICE) ->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
->setTitle(pht('Draft Post')) ->setTitle(pht('Draft Post'))
->appendChild( ->appendChild(
pht('Only you can see this draft until you publish it. '. pht(
'Use "Publish" to publish this post.'))); 'This is a draft, and is only visible to you and other users '.
'who can edit %s. Use "Publish" to publish this post.',
$viewer->renderHandle($post->getBlogPHID()))));
} }
if ($post->isArchived()) { if ($post->isArchived()) {
@ -56,8 +58,10 @@ final class PhamePostViewController
->setSeverity(PHUIInfoView::SEVERITY_ERROR) ->setSeverity(PHUIInfoView::SEVERITY_ERROR)
->setTitle(pht('Archived Post')) ->setTitle(pht('Archived Post'))
->appendChild( ->appendChild(
pht('Only you can see this archived post until you publish it. '. pht(
'Use "Publish" to publish this post.'))); 'This post has been archived, and is only visible to you and '.
'other users who can edit %s.',
$viewer->renderHandle($post->getBlogPHID()))));
} }
if (!$post->getBlog()) { if (!$post->getBlog()) {

View file

@ -200,8 +200,9 @@ final class PhamePost extends PhameDAO
} }
public function getPolicy($capability) { public function getPolicy($capability) {
// Draft posts are visible only to the author. Published posts are visible // Draft and archived posts are visible only to the author and other
// to whoever the blog is visible to. // users who can edit the blog. Published posts are visible to whoever
// the blog is visible to.
switch ($capability) { switch ($capability) {
case PhabricatorPolicyCapability::CAN_VIEW: case PhabricatorPolicyCapability::CAN_VIEW:

View file

@ -50,8 +50,9 @@ final class PhortuneSubscriptionProduct
public function didPurchaseProduct( public function didPurchaseProduct(
PhortuneProduct $product, PhortuneProduct $product,
PhortunePurchase $purchase) { PhortunePurchase $purchase) {
// TODO: Callback the subscription. return $this->getSubscription()->didPurchaseProduct(
return; $product,
$purchase);
} }
public function didRefundProduct( public function didRefundProduct(

View file

@ -232,6 +232,15 @@ final class PhortuneSubscription extends PhortuneDAO
$purchase); $purchase);
} }
public function didPurchaseProduct(
PhortuneProduct $product,
PhortunePurchase $purchase) {
return $this->getImplementation()->didPurchaseProduct(
$this,
$product,
$purchase);
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */ /* -( PhabricatorPolicyInterface )----------------------------------------- */

View file

@ -48,4 +48,12 @@ abstract class PhortuneSubscriptionImplementation extends Phobject {
PhortunePurchase $purchase) { PhortunePurchase $purchase) {
return null; return null;
} }
public function didPurchaseProduct(
PhortuneSubscription $subscription,
PhortuneProduct $product,
PhortunePurchase $purchase) {
return null;
}
} }

View file

@ -14,7 +14,7 @@ final class RepositoryQueryConduitAPIMethod
public function getMethodStatusDescription() { public function getMethodStatusDescription() {
return pht( return pht(
'This method is frozen and will eventually be deprecated. New code '. 'This method is frozen and will eventually be deprecated. New code '.
'should use "diffusion.repository.query" instead.'); 'should use "diffusion.repository.search" instead.');
} }
public function getMethodDescription() { public function getMethodDescription() {

View file

@ -24,6 +24,12 @@ same steps you would if you were creating a backup and then restoring it, you
will just backup the old machine and then restore the data onto the new will just backup the old machine and then restore the data onto the new
machine. machine.
WARNING: You need to restart Phabricator after restoring data.
Restarting Phabricator after performing a restore makes sure that caches are
flushed properly. For complete instructions, see
@{article:Restarting Phabricator}.
Backup: MySQL Databases Backup: MySQL Databases
======================= =======================

View file

@ -119,6 +119,11 @@ final class PhabricatorActionView extends AphrontView {
return $this->openInNewWindow; return $this->openInNewWindow;
} }
public function setID($id) {
$this->id = $id;
return $this;
}
public function getID() { public function getID() {
if (!$this->id) { if (!$this->id) {
$this->id = celerity_generate_unique_node_id(); $this->id = celerity_generate_unique_node_id();

View file

@ -0,0 +1,13 @@
/**
* @provides diffusion-repository-css
*/
.diffusion-page-header-view a.phui-header-action-link {
display: block;
float: none;
}
.phui-box.phui-object-box.phui-box-blue-property
.diffusion-panel-header-view.phui-header-shell {
padding: 8px 4px 8px 16px;
}