Skip to content

Commit

Permalink
Merge pull request #14666 from nextcloud/design/settings-header
Browse files Browse the repository at this point in the history
Don't show 'Personal' header in settings when Admin section is not there
  • Loading branch information
MorrisJobke authored Mar 18, 2019
2 parents c416875 + 970d52f commit 4824d27
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
4 changes: 3 additions & 1 deletion settings/templates/settings/frame.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@

<div id="app-navigation">
<ul>
<li class="app-navigation-caption"><?php p($l->t('Personal')); ?></li>
<?php if(!empty($_['forms']['admin'])) { ?>
<li class="app-navigation-caption"><?php p($l->t('Personal')); ?></li>
<?php
}
foreach($_['forms']['personal'] as $form) {
if (isset($form['anchor'])) {
$anchor = \OC::$server->getURLGenerator()->linkToRoute('settings.PersonalSettings.index', ['section' => $form['anchor']]);
Expand Down
3 changes: 2 additions & 1 deletion tests/acceptance/features/access-levels.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Feature: access-levels
Scenario: regular users cannot see admin-level items on the Settings page
Given I am logged in
When I visit the settings page
Then I see that the "Personal" settings panel is shown
Then I see that the "Personal info" entry in the settings panel is shown
And I see that the "Personal" settings panel is not shown
And I see that the "Administration" settings panel is not shown

Scenario: admin users can see admin-level items on the Settings page
Expand Down
18 changes: 18 additions & 0 deletions tests/acceptance/features/bootstrap/SettingsMenuContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ private static function settingsPanelFor($itemText) {
describedAs($itemText . " item in Settings panel");
}

/**
* @param string $itemText
* @return Locator
*/
private static function settingsPanelEntryFor($itemText) {
return Locator::forThe()->xpath("//div[@id = 'app-navigation']//ul//li[normalize-space() = '$itemText']")->
describedAs($itemText . " entry in Settings panel");
}

/**
* @return array
*/
Expand Down Expand Up @@ -188,6 +197,15 @@ public function iSeeThatTheItemSettingsPanelIsShown($itemText) {
);
}

/**
* @Then I see that the :itemText entry in the settings panel is shown
*/
public function iSeeThatTheItemEntryInTheSettingsPanelIsShown($itemText) {
PHPUnit_Framework_Assert::assertTrue(
$this->actor->find(self::settingsPanelEntryFor($itemText), 10)->isVisible()
);
}

/**
* @Then I see that the :itemText settings panel is not shown
*/
Expand Down

0 comments on commit 4824d27

Please sign in to comment.