diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/Command/App/Install.php | 8 | ||||
-rw-r--r-- | core/Command/Maintenance/Install.php | 13 | ||||
-rw-r--r-- | core/Command/Upgrade.php | 8 | ||||
-rw-r--r-- | core/ajax/update.php | 3 | ||||
-rw-r--r-- | core/css/inputs.scss | 29 | ||||
-rw-r--r-- | core/css/share.scss | 4 | ||||
-rw-r--r-- | core/js/share.js | 44 | ||||
-rw-r--r-- | core/js/tests/specs/shareSpec.js | 147 | ||||
-rw-r--r-- | core/register_command.php | 2 |
9 files changed, 210 insertions, 48 deletions
diff --git a/core/Command/App/Install.php b/core/Command/App/Install.php index c8c4652d7ba..8f530975be9 100644 --- a/core/Command/App/Install.php +++ b/core/Command/App/Install.php @@ -51,13 +51,7 @@ class Install extends Command { } try { - $installer = new Installer( - \OC::$server->getAppFetcher(), - \OC::$server->getHTTPClientService(), - \OC::$server->getTempManager(), - \OC::$server->getLogger(), - \OC::$server->getConfig() - ); + $installer = \OC::$server->query(Installer::class); $installer->downloadApp($appId); $result = $installer->installApp($appId); } catch(\Exception $e) { diff --git a/core/Command/Maintenance/Install.php b/core/Command/Maintenance/Install.php index 755d3d386c1..be6a2da22c8 100644 --- a/core/Command/Maintenance/Install.php +++ b/core/Command/Maintenance/Install.php @@ -30,6 +30,7 @@ namespace OC\Core\Command\Maintenance; use InvalidArgumentException; +use OC\Installer; use OC\Setup; use OC\SystemConfig; use OCP\Defaults; @@ -73,9 +74,15 @@ class Install extends Command { // validate the environment $server = \OC::$server; - $setupHelper = new Setup($this->config, $server->getIniWrapper(), - $server->getL10N('lib'), $server->query(Defaults::class), $server->getLogger(), - $server->getSecureRandom()); + $setupHelper = new Setup( + $this->config, + $server->getIniWrapper(), + $server->getL10N('lib'), + $server->query(Defaults::class), + $server->getLogger(), + $server->getSecureRandom(), + \OC::$server->query(Installer::class) + ); $sysInfo = $setupHelper->getSystemInfo(true); $errors = $sysInfo['errors']; if (count($errors) > 0) { diff --git a/core/Command/Upgrade.php b/core/Command/Upgrade.php index 0877c19bc01..2a502dbe921 100644 --- a/core/Command/Upgrade.php +++ b/core/Command/Upgrade.php @@ -35,6 +35,7 @@ namespace OC\Core\Command; use OC\Console\TimestampFormatter; +use OC\Installer; use OC\Updater; use OCP\IConfig; use OCP\ILogger; @@ -63,11 +64,13 @@ class Upgrade extends Command { /** * @param IConfig $config * @param ILogger $logger + * @param Installer $installer */ - public function __construct(IConfig $config, ILogger $logger) { + public function __construct(IConfig $config, ILogger $logger, Installer $installer) { parent::__construct(); $this->config = $config; $this->logger = $logger; + $this->installer = $installer; } protected function configure() { @@ -101,7 +104,8 @@ class Upgrade extends Command { $updater = new Updater( $this->config, \OC::$server->getIntegrityCodeChecker(), - $this->logger + $this->logger, + $this->installer ); if ($input->getOption('no-app-disable')) { diff --git a/core/ajax/update.php b/core/ajax/update.php index 71d60f5c432..2a29d1e536c 100644 --- a/core/ajax/update.php +++ b/core/ajax/update.php @@ -116,7 +116,8 @@ if (OC::checkUpgrade(false)) { $updater = new \OC\Updater( $config, \OC::$server->getIntegrityCodeChecker(), - $logger + $logger, + \OC::$server->query(\OC\Installer::class) ); $incompatibleApps = []; $disabledThirdPartyApps = []; diff --git a/core/css/inputs.scss b/core/css/inputs.scss index 20e8cbf08e0..00e0e47f9a8 100644 --- a/core/css/inputs.scss +++ b/core/css/inputs.scss @@ -13,7 +13,7 @@ */ /* Specifically override browser styles */ -input, textarea, select, button, div[contenteditable=true] { +input, textarea, select, button, div[contenteditable=true], div[contenteditable=false] { font-family: 'Open Sans', Frutiger, Calibri, 'Myriad Pro', Myriad, sans-serif; } .select2-container-multi .select2-choices .select2-search-field input, .select2-search input, .ui-widget { @@ -25,7 +25,8 @@ select, button, input, textarea, -div[contenteditable=true] { +div[contenteditable=true], +div[contenteditable=false] { width: 130px; min-height: 32px; box-sizing: border-box; @@ -88,6 +89,23 @@ div[contenteditable=true], } } +div[contenteditable=false] { + margin: 3px 3px 3px 0; + padding: 7px 6px; + font-size: 13px; + background-color: $color-main-background; + color: nc-lighten($color-main-text, 33%); + border: 1px solid nc-darken($color-main-background, 14%); + outline: none; + border-radius: $border-radius; + cursor: text; + + background-color: nc-darken($color-main-background, 8%); + color: rgba($color-main-text, 0.4); + cursor: default; + opacity: 0.5; +} + /* Specific override */ input { &:not([type='radio']):not([type='checkbox']):not([type='range']):not([type='submit']):not([type='button']):not([type='reset']):not([type='color']):not([type='file']):not([type='image']) { @@ -171,6 +189,13 @@ textarea, div[contenteditable=true] { } } +div[contenteditable=false] { + color: nc-lighten($color-main-text, 33%); + cursor: text; + font-family: inherit; + height: auto; +} + /* Override the ugly select arrow */ select { -webkit-appearance: none; diff --git a/core/css/share.scss b/core/css/share.scss index 37217fa926a..68b601bcb65 100644 --- a/core/css/share.scss +++ b/core/css/share.scss @@ -177,9 +177,11 @@ } .contactsmenu-popover { - left: -8px; + left: -6px; right: auto; padding: 3px 6px; + top: 100%; + margin-top: 0; li.hidden { display: none !important; } diff --git a/core/js/share.js b/core/js/share.js index 25d59b46fb4..7662d6cffb9 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -161,7 +161,6 @@ OC.Share = _.extend(OC.Share || {}, { updateIcon:function(itemType, itemSource) { var shares = false; var link = false; - var image = OC.imagePath('core', 'actions/share'); var iconClass = ''; $.each(OC.Share.itemShares, function(index) { if (OC.Share.itemShares[index]) { @@ -200,15 +199,17 @@ OC.Share = _.extend(OC.Share || {}, { /** * Format a remote address * - * @param {String} remoteAddress full remote share + * @param {String} shareWith userid, full remote share, or whatever + * @param {String} shareWithDisplayName + * @param {String} message * @return {String} HTML code to display */ - _formatRemoteShare: function(remoteAddress, message) { - var parts = this._REMOTE_OWNER_REGEXP.exec(remoteAddress); + _formatRemoteShare: function(shareWith, shareWithDisplayName, message) { + var parts = this._REMOTE_OWNER_REGEXP.exec(shareWith); if (!parts) { // display avatar of the user - var avatar = '<span class="avatar" data-userName="' + escapeHTML(remoteAddress) + '" title="' + message + " " + escapeHTML(remoteAddress) + '"></span>'; - var hidden = '<span class="hidden-visually">' + message + ' ' + escapeHTML(remoteAddress) + '</span> '; + var avatar = '<span class="avatar" data-username="' + escapeHTML(shareWith) + '" title="' + message + " " + escapeHTML(shareWithDisplayName) + '"></span>'; + var hidden = '<span class="hidden-visually">' + message + ' ' + escapeHTML(shareWithDisplayName) + '</span> '; return avatar + hidden; } @@ -238,14 +239,17 @@ OC.Share = _.extend(OC.Share || {}, { * Loop over all recipients in the list and format them using * all kind of fancy magic. * - * @param {String[]} recipients array of all the recipients + * @param {Object} recipients array of all the recipients * @return {String[]} modified list of recipients */ _formatShareList: function(recipients) { var _parent = this; + recipients = _.toArray(recipients); + recipients.sort(function(a, b) { + return a.shareWithDisplayName.localeCompare(b.shareWithDisplayName); + }); return $.map(recipients, function(recipient) { - recipient = _parent._formatRemoteShare(recipient, t('core', 'Shared with')); - return recipient; + return _parent._formatRemoteShare(recipient.shareWith, recipient.shareWithDisplayName, t('core', 'Shared with')); }); }, /** @@ -261,12 +265,13 @@ OC.Share = _.extend(OC.Share || {}, { var type = $tr.data('type'); var icon = action.find('.icon'); var message, recipients, avatars; + var ownerId = $tr.attr('data-share-owner-id'); var owner = $tr.attr('data-share-owner'); var shareFolderIcon; var iconClass = 'icon-shared'; action.removeClass('shared-style'); // update folder icon - if (type === 'dir' && (hasShares || hasLink || owner)) { + if (type === 'dir' && (hasShares || hasLink || ownerId)) { if (hasLink) { shareFolderIcon = OC.MimeType.getIconUrl('dir-public'); } @@ -290,25 +295,26 @@ OC.Share = _.extend(OC.Share || {}, { $tr.find('.filename .thumbnail').css('background-image', 'url(' + shareFolderIcon + ')'); } // update share action text / icon - if (hasShares || owner) { - recipients = $tr.attr('data-share-recipients'); + if (hasShares || ownerId) { + recipients = $tr.data('share-recipient-data'); action.addClass('shared-style'); avatars = '<span>' + t('core', 'Shared') + '</span>'; // even if reshared, only show "Shared by" - if (owner) { + if (ownerId) { message = t('core', 'Shared by'); - avatars = this._formatRemoteShare(owner, message); + avatars = this._formatRemoteShare(ownerId, owner, message); } else if (recipients) { - avatars = this._formatShareList(recipients.split(', ')).join(''); + avatars = this._formatShareList(recipients); } action.html(avatars).prepend(icon); - if (owner || recipients) { + if (ownerId || recipients) { var avatarElement = action.find('.avatar'); - avatarElement.avatar(avatarElement.data('username'), 32); - - action.find('.icon-shared + span').tooltip({placement: 'top'}); + avatarElement.each(function () { + $(this).avatar($(this).data('username'), 32); + }); + action.find('span[title]').tooltip({placement: 'top'}); } } else { action.html('<span class="hidden-visually">' + t('core', 'Shared') + '</span>').prepend(icon); diff --git a/core/js/tests/specs/shareSpec.js b/core/js/tests/specs/shareSpec.js index 70c698c99a2..05057692e98 100644 --- a/core/js/tests/specs/shareSpec.js +++ b/core/js/tests/specs/shareSpec.js @@ -45,6 +45,7 @@ describe('OC.Share tests', function() { var $action; $file.attr('data-share-owner', input); + $file.attr('data-share-owner-id', input); OC.Share.markFileAsShared($file); $action = $file.find('.action-share>span').parent(); @@ -119,6 +120,7 @@ describe('OC.Share tests', function() { it('shows a shared folder icon for folders shared with the current user', function() { $file.attr('data-type', 'dir'); $file.attr('data-share-owner', 'someoneelse'); + $file.attr('data-share-owner-id', 'someoneelse'); OC.Share.markFileAsShared($file); checkIcon('filetypes/folder-shared'); @@ -155,7 +157,7 @@ describe('OC.Share tests', function() { function checkRecipients(input, output, title) { var $action; - $file.attr('data-share-recipients', input); + $file.attr('data-share-recipient-data', JSON.stringify(input)); OC.Share.markFileAsShared($file, true); $action = $file.find('.action-share>span').parent(); @@ -177,66 +179,187 @@ describe('OC.Share tests', function() { } it('displays the local share owner as is', function() { - checkRecipients('User One', 'Shared with User One', null); + var input = { + 0: { + shareWith: 'User One', + shareWithDisplayName: 'User One' + } + }; + checkRecipients(input, 'Shared with User One', null); }); it('displays the user name part of a remote recipient', function() { + var input = { + 0: { + shareWith: 'User One@someserver.com', + shareWithDisplayName: 'User One@someserver.com' + } + }; checkRecipients( - 'User One@someserver.com', + input, 'User One@…', 'Shared with User One@someserver.com' ); + + input = { + 0: { + shareWith: 'User One@someserver.com/', + shareWithDisplayName: 'User One@someserver.com/' + } + }; checkRecipients( - 'User One@someserver.com/', + input, 'User One@…', 'Shared with User One@someserver.com' ); + + input = { + 0: { + shareWith: 'User One@someserver.com/root/of/nextcloud', + shareWithDisplayName: 'User One@someserver.com/root/of/nextcloud' + } + }; checkRecipients( - 'User One@someserver.com/root/of/owncloud', + input, 'User One@…', 'Shared with User One@someserver.com' ); }); it('displays the user name part with domain of a remote share owner', function() { + var input = { + 0: { + shareWith: 'User One@example.com@someserver.com', + shareWithDisplayName: 'User One@example.com@someserver.com' + } + }; checkRecipients( - 'User One@example.com@someserver.com', + input, 'User One@example.com', 'Shared with User One@example.com@someserver.com' ); + + input = { + 0: { + shareWith: 'User One@example.com@someserver.com/', + shareWithDisplayName: 'User One@example.com@someserver.com/' + } + }; checkRecipients( - 'User One@example.com@someserver.com/', + input, 'User One@example.com', 'Shared with User One@example.com@someserver.com' ); + + input = { + 0: { + shareWith: 'User One@example.com@someserver.com/root/of/nextcloud', + shareWithDisplayName: 'User One@example.com@someserver.com/root/of/nextcloud' + } + }; checkRecipients( - 'User One@example.com@someserver.com/root/of/owncloud', + input, 'User One@example.com', 'Shared with User One@example.com@someserver.com' ); }); it('display multiple remote recipients', function() { + var input = { + 0: { + shareWith: 'One@someserver.com', + shareWithDisplayName: 'One@someserver.com' + }, + 1: { + shareWith: 'two@otherserver.com', + shareWithDisplayName: 'two@otherserver.com' + } + }; checkRecipients( - 'One@someserver.com, two@otherserver.com', + input, 'One@… two@…', ['Shared with One@someserver.com', 'Shared with two@otherserver.com'] ); + + input = { + 0: { + shareWith: 'One@someserver.com/', + shareWithDisplayName: 'One@someserver.com/' + }, + 1: { + shareWith: 'two@someserver.com', + shareWithDisplayName: 'two@someserver.com' + } + }; checkRecipients( - 'One@someserver.com/, two@otherserver.com', + input, 'One@… two@…', ['Shared with One@someserver.com', 'Shared with two@otherserver.com'] ); + + input = { + 0: { + shareWith: 'One@someserver.com/root/of/nextcloud', + shareWithDisplayName: 'One@someserver.com/root/of/nextcloud' + }, + 1: { + shareWith: 'two@someserver.com', + shareWithDisplayName: 'two@someserver.com' + } + }; checkRecipients( - 'One@someserver.com/root/of/owncloud, two@otherserver.com', + input, 'One@… two@…', ['Shared with One@someserver.com', 'Shared with two@otherserver.com'] ); }); it('display mixed recipients', function() { checkRecipients( - 'One, two@otherserver.com', + { + 0: { + shareWith: 'One', + shareWithDisplayName: 'One' + }, + 1: { + shareWith: 'two@otherserver.com', + shareWithDisplayName: 'two@otherserver.com' + } + }, 'Shared with One two@…', ['Shared with two@otherserver.com'] ); }); + it('display multiple with divergent displaynames', function() { + var recipients = { + 0: { + shareWith: 'One', + shareWithDisplayName: 'Yoko Ono', + _output: 'Shared with Yoko Ono' + }, + 1: { + shareWith: 'two@otherserver.com', + shareWithDisplayName: 'two@othererver.com', + _output: 'two@…' + }, + 2: { + shareWith: 'Three', + shareWithDisplayName: 'Green, Mina', + _output: 'Shared with Green, Mina' + } + }; + + // we cannot assume the locale, also because PhantomJS has a bug. + var sortArray = _.toArray(recipients) + .sort(function(a, b) { + return a.shareWithDisplayName.localeCompare(b.shareWithDisplayName); + }); + var sortedOutput = _.map(sortArray, function(recipient) { + return recipient._output; + }).join(' '); + + checkRecipients( + recipients, + sortedOutput, + ['Shared with two@otherserver.com'] + ); + }); }); }); }); diff --git a/core/register_command.php b/core/register_command.php index 3f7fbf508e5..60e151a5f2c 100644 --- a/core/register_command.php +++ b/core/register_command.php @@ -137,7 +137,7 @@ if (\OC::$server->getConfig()->getSystemValue('installed', false)) { $application->add(new OC\Core\Command\Maintenance\UpdateHtaccess()); $application->add(new OC\Core\Command\Maintenance\UpdateTheme(\OC::$server->getMimeTypeDetector(), \OC::$server->getMemCacheFactory())); - $application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->getLogger())); + $application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->query(\OC\Installer::class))); $application->add(new OC\Core\Command\Maintenance\Repair( new \OC\Repair(\OC\Repair::getRepairSteps(), \OC::$server->getEventDispatcher()), \OC::$server->getConfig(), \OC::$server->getEventDispatcher(), \OC::$server->getAppManager())); |