From 403eb87f4db42c03b3df9103de19df2b4a3fac96 Mon Sep 17 00:00:00 2001 From: Robin McCorkell Date: Wed, 16 Mar 2016 22:06:49 +0000 Subject: [PATCH] Display external storage GUI even if user mounting disabled --- apps/files_external/appinfo/application.php | 4 +--- apps/files_external/js/settings.js | 1 + apps/files_external/personal.php | 1 + apps/files_external/settings.php | 1 - apps/files_external/templates/settings.php | 6 +++++- apps/files_external/tests/js/settingsSpec.js | 6 ++++++ 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/apps/files_external/appinfo/application.php b/apps/files_external/appinfo/application.php index 0f08cc6004..cdc58aed7e 100644 --- a/apps/files_external/appinfo/application.php +++ b/apps/files_external/appinfo/application.php @@ -59,9 +59,7 @@ class Application extends App { $backendService = $container->query('OCA\\Files_External\\Service\\BackendService'); \OCP\App::registerAdmin('files_external', 'settings'); - if ($backendService->isUserMountingAllowed()) { - \OCP\App::registerPersonal('files_external', 'personal'); - } + \OCP\App::registerPersonal('files_external', 'personal'); } /** diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js index ceacbf4afa..0b33458bec 100644 --- a/apps/files_external/js/settings.js +++ b/apps/files_external/js/settings.js @@ -813,6 +813,7 @@ MountConfigListView.prototype = _.extend({ this.$el.find('tbody').append($tr.clone()); $tr.data('storageConfig', storageConfig); + $tr.show(); $tr.find('td').last().attr('class', 'remove'); $tr.find('td.mountOptionsToggle').removeClass('hidden'); $tr.find('td').last().removeAttr('style'); diff --git a/apps/files_external/personal.php b/apps/files_external/personal.php index 4d8f480ecc..5c568f45b7 100644 --- a/apps/files_external/personal.php +++ b/apps/files_external/personal.php @@ -38,4 +38,5 @@ $tmpl->assign('storages', $userStoragesService->getStorages()); $tmpl->assign('dependencies', OC_Mount_Config::dependencyMessage($backendService->getBackends())); $tmpl->assign('backends', $backendService->getAvailableBackends()); $tmpl->assign('authMechanisms', $backendService->getAuthMechanisms()); +$tmpl->assign('allowUserMounting', $backendService->isUserMountingAllowed()); return $tmpl->fetchPage(); diff --git a/apps/files_external/settings.php b/apps/files_external/settings.php index 5bc330ff18..0d83d26ff9 100644 --- a/apps/files_external/settings.php +++ b/apps/files_external/settings.php @@ -44,5 +44,4 @@ $tmpl->assign('backends', $backendService->getAvailableBackends()); $tmpl->assign('authMechanisms', $backendService->getAuthMechanisms()); $tmpl->assign('dependencies', OC_Mount_Config::dependencyMessage($backendService->getBackends())); $tmpl->assign('allowUserMounting', $backendService->isUserMountingAllowed()); -$tmpl->assign('allowUserMounting', $backendService->isUserMountingAllowed()); return $tmpl->fetchPage(); diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index f7caf3d2ca..697a145131 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -85,7 +85,11 @@ - + + style="display: none;" + + > diff --git a/apps/files_external/tests/js/settingsSpec.js b/apps/files_external/tests/js/settingsSpec.js index 2a7afd6c2f..462407e954 100644 --- a/apps/files_external/tests/js/settingsSpec.js +++ b/apps/files_external/tests/js/settingsSpec.js @@ -179,6 +179,12 @@ describe('OCA.External.Settings tests', function() { // TODO: check "remove" button visibility }); + it('shows row even if selection row is hidden', function() { + view.$el.find('tr#addMountPoint').hide(); + selectBackend('\\OC\\TestBackend'); + expect(view.$el.find('tr:first').is(':visible')).toBe(true); + expect(view.$el.find('tr#addMountPoint').is(':visible')).toBe(false); + }); // TODO: test with personal mounts (no applicable fields) // TODO: test suggested mount point logic });