Browse Source

Merge pull request #10391 from nextcloud/bugfix/10389/fix-app-navigation-controller

Fix app navigation controller to return an array
tags/v14.0.0beta1
Morris Jobke 5 years ago
parent
commit
70fa73404f
No account linked to committer's email address

+ 2
- 1
core/Controller/NavigationController.php View File

@@ -55,7 +55,7 @@ class NavigationController extends OCSController {
if ($absolute) {
$navigation = $this->rewriteToAbsoluteUrls($navigation);
}
$navigation = array_values($navigation);
$etag = $this->generateETag($navigation);
if ($this->request->getHeader('If-None-Match') === $etag) {
return new DataResponse([], Http::STATUS_NOT_MODIFIED);
@@ -77,6 +77,7 @@ class NavigationController extends OCSController {
if ($absolute) {
$navigation = $this->rewriteToAbsoluteUrls($navigation);
}
$navigation = array_values($navigation);
$etag = $this->generateETag($navigation);
if ($this->request->getHeader('If-None-Match') === $etag) {
return new DataResponse([], Http::STATUS_NOT_MODIFIED);

+ 1
- 1
settings/js/apps.js View File

@@ -6,7 +6,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
if(response.ocs.meta.status === 'ok') {
var addedApps = {};
var navEntries = response.ocs.data;
var container = $('#navigation #apps');
var container = $('#navigation #apps ul');

// remove disabled apps
for (var i = 0; i < navEntries.length; i++) {

+ 2
- 2
tests/Core/Controller/NavigationControllerTest.php View File

@@ -69,7 +69,7 @@ class NavigationControllerTest extends TestCase {
$this->navigationManager->expects($this->once())
->method('getAll')
->with('link')
->willReturn([ ['id' => 'files', 'href' => '/index.php/apps/files', 'icon' => 'icon' ] ]);
->willReturn(['files' => ['id' => 'files', 'href' => '/index.php/apps/files', 'icon' => 'icon' ] ]);
if ($absolute) {
$this->urlGenerator->expects($this->any())
->method('getBaseURL')
@@ -102,7 +102,7 @@ class NavigationControllerTest extends TestCase {
$this->navigationManager->expects($this->once())
->method('getAll')
->with('settings')
->willReturn([ ['id' => 'settings', 'href' => '/index.php/settings/user', 'icon' => '/core/img/settings.svg'] ]);
->willReturn(['settings' => ['id' => 'settings', 'href' => '/index.php/settings/user', 'icon' => '/core/img/settings.svg'] ]);
if ($absolute) {
$this->urlGenerator->expects($this->any())
->method('getBaseURL')

Loading…
Cancel
Save