mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
Don't show Conpherence controls if not in a Conpherence
Summary: We currently try to build crumbs out even if the user has no membership in any. This removes these useless controls. Test Plan: Leave all Rooms, see NUX state with no "Edit Room", blank title, or "Collapse Column" controls. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D16546
This commit is contained in:
parent
2588b4fac0
commit
5d8b5c0ee3
1 changed files with 40 additions and 38 deletions
|
@ -59,47 +59,49 @@ abstract class ConpherenceController extends PhabricatorController {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
$data = $conpherence->getDisplayData($this->getViewer());
|
|
||||||
$crumbs->addCrumb(
|
|
||||||
id(new PHUICrumbView())
|
|
||||||
->setName($data['title'])
|
|
||||||
->setHref('/'.$conpherence->getMonogram()));
|
|
||||||
|
|
||||||
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
if ($conpherence->getID()) {
|
||||||
$viewer,
|
$data = $conpherence->getDisplayData($this->getViewer());
|
||||||
$conpherence,
|
$crumbs->addCrumb(
|
||||||
PhabricatorPolicyCapability::CAN_EDIT);
|
id(new PHUICrumbView())
|
||||||
|
->setName($data['title'])
|
||||||
|
->setHref('/'.$conpherence->getMonogram()));
|
||||||
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||||
|
$viewer,
|
||||||
|
$conpherence,
|
||||||
|
PhabricatorPolicyCapability::CAN_EDIT);
|
||||||
|
|
||||||
$crumbs
|
$crumbs
|
||||||
->addAction(
|
->addAction(
|
||||||
|
id(new PHUIListItemView())
|
||||||
|
->setName(pht('Edit Room'))
|
||||||
|
->setHref(
|
||||||
|
$this->getApplicationURI('update/'.$conpherence->getID()).'/')
|
||||||
|
->setIcon('fa-pencil')
|
||||||
|
->setDisabled(!$can_edit)
|
||||||
|
->setWorkflow(true));
|
||||||
|
|
||||||
|
$widget_key = PhabricatorConpherenceWidgetVisibleSetting::SETTINGKEY;
|
||||||
|
$widget_view = (bool)$viewer->getUserSetting($widget_key, false);
|
||||||
|
|
||||||
|
$divider = id(new PHUIListItemView())
|
||||||
|
->setType(PHUIListItemView::TYPE_DIVIDER)
|
||||||
|
->addClass('conpherence-header-desktop-item');
|
||||||
|
$crumbs->addAction($divider);
|
||||||
|
|
||||||
|
Javelin::initBehavior(
|
||||||
|
'toggle-widget',
|
||||||
|
array(
|
||||||
|
'show' => (int)$widget_view,
|
||||||
|
'settingsURI' => '/settings/adjust/?key='.$widget_key,
|
||||||
|
));
|
||||||
|
|
||||||
|
$crumbs->addAction(
|
||||||
id(new PHUIListItemView())
|
id(new PHUIListItemView())
|
||||||
->setName(pht('Edit Room'))
|
->addSigil('conpherence-widget-toggle')
|
||||||
->setHref(
|
->setIcon('fa-columns')
|
||||||
$this->getApplicationURI('update/'.$conpherence->getID()).'/')
|
->addClass('conpherence-header-desktop-item'));
|
||||||
->setIcon('fa-pencil')
|
}
|
||||||
->setDisabled(!$can_edit)
|
|
||||||
->setWorkflow(true));
|
|
||||||
|
|
||||||
$widget_key = PhabricatorConpherenceWidgetVisibleSetting::SETTINGKEY;
|
|
||||||
$widget_view = (bool)$viewer->getUserSetting($widget_key, false);
|
|
||||||
|
|
||||||
$divider = id(new PHUIListItemView())
|
|
||||||
->setType(PHUIListItemView::TYPE_DIVIDER)
|
|
||||||
->addClass('conpherence-header-desktop-item');
|
|
||||||
$crumbs->addAction($divider);
|
|
||||||
|
|
||||||
Javelin::initBehavior(
|
|
||||||
'toggle-widget',
|
|
||||||
array(
|
|
||||||
'show' => (int)$widget_view,
|
|
||||||
'settingsURI' => '/settings/adjust/?key='.$widget_key,
|
|
||||||
));
|
|
||||||
|
|
||||||
$crumbs->addAction(
|
|
||||||
id(new PHUIListItemView())
|
|
||||||
->addSigil('conpherence-widget-toggle')
|
|
||||||
->setIcon('fa-columns')
|
|
||||||
->addClass('conpherence-header-desktop-item'));
|
|
||||||
|
|
||||||
return hsprintf(
|
return hsprintf(
|
||||||
'%s',
|
'%s',
|
||||||
|
|
Loading…
Reference in a new issue