diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/BearerAuth.php | 14 | ||||
-rw-r--r-- | apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php | 12 | ||||
-rw-r--r-- | apps/federatedfilesharing/templates/settings-admin.php | 2 | ||||
-rw-r--r-- | apps/files/css/files.scss | 38 | ||||
-rw-r--r-- | apps/files/js/app.js | 4 | ||||
-rw-r--r-- | apps/files/js/files.js | 2 | ||||
-rw-r--r-- | apps/files/js/navigation.js | 4 | ||||
-rw-r--r-- | apps/files/lib/Controller/ViewController.php | 16 | ||||
-rw-r--r-- | apps/files/templates/appnavigation.php | 18 | ||||
-rw-r--r-- | apps/files/templates/index.php | 4 | ||||
-rw-r--r-- | apps/files/tests/Controller/ViewControllerTest.php | 8 | ||||
-rw-r--r-- | apps/files_trashbin/css/trash.css | 9 | ||||
-rw-r--r-- | apps/oauth2/appinfo/info.xml | 4 | ||||
-rw-r--r-- | apps/sharebymail/lib/ShareByMailProvider.php | 17 |
14 files changed, 133 insertions, 19 deletions
diff --git a/apps/dav/lib/Connector/Sabre/BearerAuth.php b/apps/dav/lib/Connector/Sabre/BearerAuth.php index f0e0f389c33..b7fd9116f21 100644 --- a/apps/dav/lib/Connector/Sabre/BearerAuth.php +++ b/apps/dav/lib/Connector/Sabre/BearerAuth.php @@ -25,6 +25,8 @@ use OCP\IRequest; use OCP\ISession; use OCP\IUserSession; use Sabre\DAV\Auth\Backend\AbstractBearer; +use Sabre\HTTP\RequestInterface; +use Sabre\HTTP\ResponseInterface; class BearerAuth extends AbstractBearer { /** @var IUserSession */ @@ -77,4 +79,16 @@ class BearerAuth extends AbstractBearer { return false; } + + /** + * \Sabre\DAV\Auth\Backend\AbstractBearer::challenge sets an WWW-Authenticate + * header which some DAV clients can't handle. Thus we override this function + * and make it simply return a 401. + * + * @param RequestInterface $request + * @param ResponseInterface $response + */ + public function challenge(RequestInterface $request, ResponseInterface $response) { + $response->setStatus(401); + } } diff --git a/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php b/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php index 5eae75eb8e9..04bb035a635 100644 --- a/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php @@ -21,9 +21,6 @@ namespace OCA\DAV\Tests\unit\Connector\Sabre; -use OC\Authentication\TwoFactorAuth\Manager; -use OC\Security\Bruteforce\Throttler; -use OC\User\Session; use OCA\DAV\Connector\Sabre\BearerAuth; use OCP\IRequest; use OCP\ISession; @@ -85,4 +82,13 @@ class BearerAuthTest extends TestCase { $this->assertSame('principals/users/admin', $this->bearerAuth->validateBearerToken('Token')); } + + public function testChallenge() { + /** @var \PHPUnit_Framework_MockObject_MockObject|RequestInterface $request */ + $request = $this->createMock(RequestInterface::class); + /** @var \PHPUnit_Framework_MockObject_MockObject|ResponseInterface $response */ + $response = $this->createMock(ResponseInterface::class); + $result = $this->bearerAuth->challenge($request, $response); + $this->assertEmpty($result); + } } diff --git a/apps/federatedfilesharing/templates/settings-admin.php b/apps/federatedfilesharing/templates/settings-admin.php index e106f1dc4e7..7fe1b5f62e6 100644 --- a/apps/federatedfilesharing/templates/settings-admin.php +++ b/apps/federatedfilesharing/templates/settings-admin.php @@ -32,7 +32,7 @@ script('federatedfilesharing', 'settings-admin'); <input type="checkbox" name="lookupServerEnabled" id="lookupServerEnabled" class="checkbox" value="1" <?php if ($_['lookupServerEnabled']) print_unescaped('checked="checked"'); ?> /> <label for="lookupServerEnabled"> - <?php p($l->t('Search global and public address book for users and let local users publish their data'));?> + <?php p($l->t('Search global and public address book for users'));?> </label><br/> </p> <p> diff --git a/apps/files/css/files.scss b/apps/files/css/files.scss index 579cf36e15b..5f32916650d 100644 --- a/apps/files/css/files.scss +++ b/apps/files/css/files.scss @@ -108,6 +108,10 @@ .nav-icon-trashbin { background-image: url('../img/delete.svg?v=1'); } +/* no icon for the quota bar */ +.nav-icon-quota { + padding-left: 15px !important; +} #app-navigation .nav-files a.nav-icon-files { width: auto; @@ -747,3 +751,37 @@ table.dragshadow td.size { #filestable tbody tr.canDrop { background-color: rgba(255, 255, 140, 1); } + + +#quota { + margin: 0 !important; + border: none; + border-radius: 0; + position: fixed !important; + bottom: 44px; + width: inherit !important; + background-color: #fff; + border-right: 1px solid #eee; + z-index:1; + + .quota-container { + height: 5px; + border-radius: 3px; + + div { + height: 100%; + background-color: $color-primary; + } + } +} + +/* increase the padding of the last item to not hide below the quota item */ +.app-files #app-navigation > ul li:nth-last-child(1) { + margin-bottom: 44px; +} + +#quotatext { + padding: 0; + height: 30px; + line-height: 30px; +} diff --git a/apps/files/js/app.js b/apps/files/js/app.js index d46a0b8f9df..47011d23f44 100644 --- a/apps/files/js/app.js +++ b/apps/files/js/app.js @@ -108,6 +108,10 @@ // trigger URL change event handlers this._onPopState(urlParams); + $('#quota.has-tooltip').tooltip({ + placement: 'top' + }); + this._debouncedPersistShowHiddenFilesState = _.debounce(this._persistShowHiddenFilesState, 1200); }, diff --git a/apps/files/js/files.js b/apps/files/js/files.js index a30194013e5..cdc2e27a612 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -363,7 +363,7 @@ var createDragShadow = function(event) { tbody.append(newtr); if (elem.type === 'dir') { newtr.find('td.filename') - .css('background-image', 'url(' + OC.imagePath('core', 'filetypes/folder.svg') + ')'); + .css('background-image', 'url(' + OC.MimeType.getIconUrl('folder') + ')'); } else { var path = dir + '/' + elem.name; Files.lazyLoadPreview(path, elem.mimetype, function(previewpath) { diff --git a/apps/files/js/navigation.js b/apps/files/js/navigation.js index 83cd556c89a..d213d0467b6 100644 --- a/apps/files/js/navigation.js +++ b/apps/files/js/navigation.js @@ -123,7 +123,9 @@ _onClickItem: function(ev) { var $target = $(ev.target); var itemId = $target.closest('li').attr('data-id'); - this.setActiveItem(itemId); + if (!_.isUndefined(itemId)) { + this.setActiveItem(itemId); + } ev.preventDefault(); } }; diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index f7a4318e595..bfeb2cafcf6 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -41,6 +41,7 @@ use OCP\IUserSession; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use OCP\Files\Folder; use OCP\App\IAppManager; +use Symfony\Component\EventDispatcher\GenericEvent; /** * Class ViewController @@ -174,6 +175,17 @@ class ViewController extends Controller { }); $nav->assign('navigationItems', $navItems); + + $nav->assign('usage', \OC_Helper::humanFileSize($storageInfo['used'])); + if ($storageInfo['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) { + $totalSpace = $this->l10n->t('Unlimited'); + } else { + $totalSpace = \OC_Helper::humanFileSize($storageInfo['total']); + } + $nav->assign('total_space', $totalSpace); + $nav->assign('quota', $storageInfo['quota']); + $nav->assign('usage_relative', $storageInfo['relative']); + $contentItems = []; // render the container content for every navigation item @@ -188,7 +200,8 @@ class ViewController extends Controller { $contentItems[] = $contentItem; } - $this->eventDispatcher->dispatch('OCA\Files::loadAdditionalScripts'); + $event = new GenericEvent(null, ['hiddenFields' => []]); + $this->eventDispatcher->dispatch('OCA\Files::loadAdditionalScripts', $event); $params = []; $params['usedSpacePercent'] = (int)$storageInfo['relative']; @@ -204,6 +217,7 @@ class ViewController extends Controller { $params['fileNotFound'] = $fileNotFound ? 1 : 0; $params['appNavigation'] = $nav; $params['appContents'] = $contentItems; + $params['hiddenFields'] = $event->getArgument('hiddenFields'); $response = new TemplateResponse( $this->appName, diff --git a/apps/files/templates/appnavigation.php b/apps/files/templates/appnavigation.php index 9c79f806713..bbd78079d39 100644 --- a/apps/files/templates/appnavigation.php +++ b/apps/files/templates/appnavigation.php @@ -1,5 +1,23 @@ <div id="app-navigation"> <ul class="with-icon"> + <li id="quota" class="section <?php + if ($_['quota'] !== \OCP\Files\FileInfo::SPACE_UNLIMITED) { + ?>has-tooltip" title="<?php p($_['usage_relative'] . '%'); + } ?>"> + <a href="#" class="nav-icon-quota svg"> + <p id="quotatext"><?php + if ($_['quota'] !== \OCP\Files\FileInfo::SPACE_UNLIMITED) { + p($l->t('%s of %s used', [$_['usage'], $_['total_space']])); + } else { + p($l->t('%s used', [$_['usage']])); + } ?></p> + <div class="quota-container"> + <div style="width:<?php p($_['usage_relative']);?>%" + <?php if($_['usage_relative'] > 80): ?>class="quota-warning"<?php endif; ?>> + </div> + </div> + </a> + </li> <?php foreach ($_['navigationItems'] as $item) { ?> <li data-id="<?php p($item['id']) ?>" class="nav-<?php p($item['id']) ?>"> <a href="<?php p(isset($item['href']) ? $item['href'] : '#') ?>" diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index 1670ccfd138..b49684643bb 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -21,3 +21,7 @@ <input type="hidden" name="defaultFileSortingDirection" id="defaultFileSortingDirection" value="<?php p($_['defaultFileSortingDirection']) ?>" /> <input type="hidden" name="showHiddenFiles" id="showHiddenFiles" value="<?php p($_['showHiddenFiles']); ?>" /> <?php endif; + +foreach ($_['hiddenFields'] as $name => $value) {?> +<input type="hidden" name="<?php p($name) ?>" id="<?php p($name) ?>" value="<?php p($value) ?>" /> +<?php } diff --git a/apps/files/tests/Controller/ViewControllerTest.php b/apps/files/tests/Controller/ViewControllerTest.php index 2e497405a4d..db86e0037ef 100644 --- a/apps/files/tests/Controller/ViewControllerTest.php +++ b/apps/files/tests/Controller/ViewControllerTest.php @@ -107,6 +107,9 @@ class ViewControllerTest extends TestCase { ->expects($this->once()) ->method('getStorageInfo') ->will($this->returnValue([ + 'used' => 123, + 'quota' => 100, + 'total' => 100, 'relative' => 123, 'owner' => 'MyName', 'ownerDisplayName' => 'MyDisplayName', @@ -125,6 +128,10 @@ class ViewControllerTest extends TestCase { ->will($this->returnArgument(2)); $nav = new Template('files', 'appnavigation'); + $nav->assign('usage_relative', 123); + $nav->assign('usage', '123 B'); + $nav->assign('quota', 100); + $nav->assign('total_space', '100 B'); $nav->assign('navigationItems', [ [ 'id' => 'files', @@ -256,6 +263,7 @@ class ViewControllerTest extends TestCase { 'content' => null, ], ], + 'hiddenFields' => [], ] ); $policy = new Http\ContentSecurityPolicy(); diff --git a/apps/files_trashbin/css/trash.css b/apps/files_trashbin/css/trash.css index f150e557231..f1096d5924c 100644 --- a/apps/files_trashbin/css/trash.css +++ b/apps/files_trashbin/css/trash.css @@ -20,20 +20,17 @@ display: none; } -#app-navigation > ul { - padding-bottom: 44px; -} - /* move Deleted Files to bottom of sidebar */ .nav-trashbin { position: fixed !important; - bottom: 44px; + bottom: 88px; width: inherit !important; background-color: #fff; border-right: 1px solid #eee; + margin-bottom: 0px !important; } /* double padding to account for Deleted files entry, issue with Firefox */ .app-files #app-navigation > ul li:nth-last-child(2) { - margin-bottom: 44px; + margin-bottom: 88px; } diff --git a/apps/oauth2/appinfo/info.xml b/apps/oauth2/appinfo/info.xml index fe8ce3a1289..ccddc9a8f71 100644 --- a/apps/oauth2/appinfo/info.xml +++ b/apps/oauth2/appinfo/info.xml @@ -15,10 +15,6 @@ <nextcloud min-version="13" max-version="13" /> </dependencies> - <dependencies> - <nextcloud min-version="12" max-version="12" /> - </dependencies> - <settings> <admin>OCA\OAuth2\Settings\Admin</admin> </settings> diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index 3bcd1512c41..f4db83ea3cf 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -456,11 +456,24 @@ class ShareByMailProvider implements IShareProvider { $emailTemplate->addHeading($this->l->t('Password to access »%s«', [$filename]), false); $emailTemplate->addBodyText($htmlBodyPart, $plainBodyPart); $emailTemplate->addBodyText($this->l->t('It is protected with the following password: %s', [$password])); - $emailTemplate->addFooter(); + // The "From" contains the sharers name + $instanceName = $this->defaults->getName(); + $senderName = $this->l->t( + '%s via %s', + [ + $initiatorDisplayName, + $instanceName + ] + ); + $message->setFrom([\OCP\Util::getDefaultEmailAddress($instanceName) => $senderName]); if ($initiatorEmailAddress !== null) { - $message->setFrom([$initiatorEmailAddress => $initiatorDisplayName]); + $message->setReplyTo([$initiatorEmailAddress => $initiatorDisplayName]); + $emailTemplate->addFooter($instanceName . ' - ' . $this->defaults->getSlogan()); + } else { + $emailTemplate->addFooter(); } + $message->setTo([$shareWith]); $message->setSubject($subject); $message->setBody($emailTemplate->renderText(), 'text/plain'); |