diff options
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/files/client.js | 18 | ||||
-rw-r--r-- | core/js/js.js | 35 | ||||
-rw-r--r-- | core/js/login.js | 17 | ||||
-rw-r--r-- | core/js/lostpassword.js | 85 | ||||
-rw-r--r-- | core/js/oc-dialogs.js | 2 | ||||
-rw-r--r-- | core/js/setupchecks.js | 40 | ||||
-rw-r--r-- | core/js/share.js | 39 | ||||
-rw-r--r-- | core/js/sharedialogshareelistview.js | 6 | ||||
-rw-r--r-- | core/js/tests/specs/coreSpec.js | 4 | ||||
-rw-r--r-- | core/js/tests/specs/files/clientSpec.js | 2 | ||||
-rw-r--r-- | core/js/tests/specs/jquery.avatarSpec.js | 4 | ||||
-rw-r--r-- | core/js/tests/specs/mimeTypeSpec.js | 10 | ||||
-rw-r--r-- | core/js/tests/specs/setupchecksSpec.js | 22 | ||||
-rw-r--r-- | core/js/tests/specs/shareSpec.js | 63 | ||||
-rw-r--r-- | core/js/tests/specs/sharedialoglinkshareview.js | 1 | ||||
-rw-r--r-- | core/js/tests/specs/sharedialogshareelistview.js | 15 | ||||
-rw-r--r-- | core/js/tests/specs/sharedialogviewSpec.js | 1 |
17 files changed, 199 insertions, 165 deletions
diff --git a/core/js/files/client.js b/core/js/files/client.js index 14d18ecf80c..fa3d795d412 100644 --- a/core/js/files/client.js +++ b/core/js/files/client.js @@ -37,6 +37,7 @@ } url += options.host + this._root; + this._host = options.host; this._defaultHeaders = options.defaultHeaders || { 'X-Requested-With': 'XMLHttpRequest', 'requesttoken': OC.requestToken @@ -701,10 +702,11 @@ * @param {String} destinationPath destination path * @param {boolean} [allowOverwrite=false] true to allow overwriting, * false otherwise + * @param {Object} [headers=null] additional headers * * @return {Promise} promise */ - move: function(path, destinationPath, allowOverwrite) { + move: function(path, destinationPath, allowOverwrite, headers) { if (!path) { throw 'Missing argument "path"'; } @@ -715,9 +717,9 @@ var self = this; var deferred = $.Deferred(); var promise = deferred.promise(); - var headers = { + headers = _.extend({}, headers, { 'Destination' : this._buildUrl(destinationPath) - }; + }); if (!allowOverwrite) { headers.Overwrite = 'F'; @@ -831,6 +833,16 @@ */ getBaseUrl: function() { return this._client.baseUrl; + }, + + /** + * Returns the host + * + * @since 13.0.0 + * @return {String} base URL + */ + getHost: function() { + return this._host; } }; diff --git a/core/js/js.js b/core/js/js.js index 246aae3ac02..9af80676d5e 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1513,7 +1513,7 @@ function initCore() { var resizeMenu = function() { var appList = $('#appmenu li'); - var headerWidth = $('.header-left').width() - $('#nextcloud').width() + var headerWidth = $('.header-left').width() - $('#nextcloud').width(); var usePercentualAppMenuLimit = 0.33; var minAppsDesktop = 8; var availableWidth = headerWidth - $(appList).width(); @@ -1626,39 +1626,6 @@ function initCore() { // initial call toggleSnapperOnSize(); - // adjust controls bar width - var adjustControlsWidth = function() { - if($('#controls').length) { - var controlsWidth; - // if there is a scrollbar … - if($('#app-content').get(0).scrollHeight > $('#app-content').height()) { - if($(window).width() > 768) { - controlsWidth = $('#content').width() - $('#app-navigation').width() - getScrollBarWidth(); - if (!$('#app-sidebar').hasClass('hidden') && !$('#app-sidebar').hasClass('disappear')) { - controlsWidth -= $('#app-sidebar').width(); - } - } else { - controlsWidth = $('#content').width() - getScrollBarWidth(); - } - } else { // if there is none - if($(window).width() > 768) { - controlsWidth = $('#content').width() - $('#app-navigation').width(); - if (!$('#app-sidebar').hasClass('hidden') && !$('#app-sidebar').hasClass('disappear')) { - controlsWidth -= $('#app-sidebar').width(); - } - } else { - controlsWidth = $('#content').width(); - } - } - $('#controls').css('width', controlsWidth); - $('#controls').css('min-width', controlsWidth); - } - }; - - $(window).resize(_.debounce(adjustControlsWidth, 250)); - - $('body').delegate('#app-content', 'apprendered appresized', _.debounce(adjustControlsWidth, 150)); - } // Update live timestamps every 30 seconds diff --git a/core/js/login.js b/core/js/login.js index 81ef25ef2d4..012b4e0280e 100644 --- a/core/js/login.js +++ b/core/js/login.js @@ -12,12 +12,17 @@ */ OC.Login = _.extend(OC.Login || {}, { onLogin: function () { - $('#submit-icon') - .removeClass('icon-confirm-white') - .addClass('icon-loading-small'); - $('#submit') - .attr('value', t('core', 'Logging in …')); - return true; + // Only if password reset form is not active + if($('form[name=login][action]').length === 0) { + $('#submit-wrapper .submit-icon') + .removeClass('icon-confirm-white') + .addClass('icon-loading-small-dark'); + $('#submit') + .attr('value', t('core', 'Logging in …')); + $('.login-additional').fadeOut(); + return true; + } + return false; }, rememberLogin: function(){ diff --git a/core/js/lostpassword.js b/core/js/lostpassword.js index 1923b73a179..446d70d991e 100644 --- a/core/js/lostpassword.js +++ b/core/js/lostpassword.js @@ -14,12 +14,54 @@ OC.Lostpassword = { init : function() { $('#lost-password').click(OC.Lostpassword.resetLink); - $('#reset-password #submit').click(OC.Lostpassword.resetPassword); + $('#lost-password-back').click(OC.Lostpassword.backToLogin); + $('form[name=login]').submit(OC.Lostpassword.onSendLink); + OC.Lostpassword.resetButtons(); + }, + + resetButtons : function() { + $('#reset-password-wrapper .submit-icon') + .addClass('icon-confirm-white') + .removeClass('icon-loading-small-dark'); + $('#reset-password-submit') + .attr('value', t('core', 'Reset password')) + .prop('disabled', false); + $('#user').prop('disabled', false); + $('.login-additional').fadeIn(); + }, + + backToLogin : function(event) { + event.preventDefault(); + + $('#reset-password-wrapper').slideUp().fadeOut(); + $('#lost-password').slideDown().fadeIn(); + $('#lost-password-back').hide(); + $('.remember-login-container').slideDown().fadeIn(); + $('#submit-wrapper').slideDown().fadeIn(); + $('.groupbottom').slideDown().fadeIn(); + $('#user').parent().addClass('grouptop'); + $('#password').attr('required', true); + $('form[name=login]').removeAttr('action'); + $('#user').focus(); }, resetLink : function(event){ event.preventDefault(); - if (!$('#user').val().length){ + + $('#lost-password').hide(); + $('#lost-password-back').slideDown().fadeIn(); + $('.remember-login-container').slideUp().fadeOut(); + $('#submit-wrapper').slideUp().fadeOut(); + $('.groupbottom').slideUp().fadeOut(function(){ + $('#user').parent().removeClass('grouptop'); + }); + $('#reset-password-wrapper').slideDown().fadeIn(); + $('#password').attr('required', false); + $('form[name=login]').attr('action', 'lostpassword/email'); + $('#user').focus(); + + // Generate a browser warning for required fields if field empty + if ($('#user').val().length === 0) { $('#submit').trigger('click'); } else { if (OC.config.lost_password_link === 'disabled') { @@ -27,19 +69,37 @@ OC.Lostpassword = { } else if (OC.config.lost_password_link) { window.location = OC.config.lost_password_link; } else { - $.post( - OC.generateUrl('/lostpassword/email'), - { - user : $('#user').val() - }, - OC.Lostpassword.sendLinkDone - ).fail(function() { - OC.Lostpassword.sendLinkError(OC.Lostpassword.sendErrorMsg); - }); + OC.Lostpassword.onSendLink(); } } }, + onSendLink: function (event) { + // Only if password reset form is active + if($('form[name=login][action]').length === 1) { + if (event) { + event.preventDefault(); + } + $('#reset-password-wrapper .submit-icon') + .removeClass('icon-confirm-white') + .addClass('icon-loading-small-dark'); + $('#reset-password-submit') + .attr('value', t('core', 'Sending email …')) + .prop('disabled', true); + $('#user').prop('disabled', true); + $('.login-additional').fadeOut(); + $.post( + OC.generateUrl('/lostpassword/email'), + { + user : $('#user').val() + }, + OC.Lostpassword.sendLinkDone + ).fail(function() { + OC.Lostpassword.sendLinkError(OC.Lostpassword.sendErrorMsg); + }); + } + }, + sendLinkDone : function(result){ var sendErrorMsg; @@ -60,13 +120,14 @@ OC.Lostpassword = { // update is the better success message styling node.addClass('update').css({width:'auto'}); node.html(OC.Lostpassword.sendSuccessMsg); + OC.Lostpassword.resetButtons(); }, sendLinkError : function(msg){ var node = OC.Lostpassword.getSendStatusNode(); node.addClass('warning'); node.html(msg); - OC.Lostpassword.init(); + OC.Lostpassword.resetButtons(); }, getSendStatusNode : function(){ diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js index 1bc1399466d..9cd806720b8 100644 --- a/core/js/oc-dialogs.js +++ b/core/js/oc-dialogs.js @@ -929,7 +929,7 @@ var OCdialogs = { */ _handleTreeListSelect:function(event, type) { var self = event.data; - var dir = $(event.target).parent().data('dir'); + var dir = $(event.target).closest('.crumb').data('dir'); self._fillFilePicker(dir); var getOcDialog = (event.target).closest('.oc-dialog'); var buttonEnableDisable = $('.primary', getOcDialog); diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index 5e8ef9e6961..88e44a547e4 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -66,7 +66,7 @@ if (xhr.status !== 207) { var docUrl = placeholderUrl.replace('PLACEHOLDER', 'admin-setup-well-known-URL'); messages.push({ - msg: t('core', 'Your web server is not set up properly to resolve "{url}". Further information can be found in our <a target="_blank" rel="noreferrer" href="{docLink}">documentation</a>.', { docLink: docUrl, url: url }), + msg: t('core', 'Your web server is not set up properly to resolve "{url}". Further information can be found in our <a target="_blank" rel="noreferrer noopener" href="{docLink}">documentation</a>.', { docLink: docUrl, url: url }), type: OC.SetupChecks.MESSAGE_TYPE_INFO }); } @@ -100,13 +100,13 @@ } if(!data.isMemcacheConfigured) { messages.push({ - msg: t('core', 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a target="_blank" rel="noreferrer" href="{docLink}">documentation</a>.', {docLink: data.memcacheDocs}), + msg: t('core', 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a target="_blank" rel="noreferrer noopener" href="{docLink}">documentation</a>.', {docLink: data.memcacheDocs}), type: OC.SetupChecks.MESSAGE_TYPE_INFO }); } if(!data.isUrandomAvailable) { messages.push({ - msg: t('core', '/dev/urandom is not readable by PHP which is highly discouraged for security reasons. Further information can be found in our <a target="_blank" rel="noreferrer" href="{docLink}">documentation</a>.', {docLink: data.securityDocs}), + msg: t('core', '/dev/urandom is not readable by PHP which is highly discouraged for security reasons. Further information can be found in our <a target="_blank" rel="noreferrer noopener" href="{docLink}">documentation</a>.', {docLink: data.securityDocs}), type: OC.SetupChecks.MESSAGE_TYPE_WARNING }); } @@ -118,19 +118,19 @@ } if(data.phpSupported && data.phpSupported.eol) { messages.push({ - msg: t('core', 'You are currently running PHP {version}. We encourage you to upgrade your PHP version to take advantage of <a target="_blank" rel="noreferrer" href="{phpLink}">performance and security updates provided by the PHP Group</a> as soon as your distribution supports it.', {version: data.phpSupported.version, phpLink: 'https://secure.php.net/supported-versions.php'}), + msg: t('core', 'You are currently running PHP {version}. We encourage you to upgrade your PHP version to take advantage of <a target="_blank" rel="noreferrer noopener" href="{phpLink}">performance and security updates provided by the PHP Group</a> as soon as your distribution supports it.', {version: data.phpSupported.version, phpLink: 'https://secure.php.net/supported-versions.php'}), type: OC.SetupChecks.MESSAGE_TYPE_INFO }); } if(!data.forwardedForHeadersWorking) { messages.push({ - msg: t('core', 'The reverse proxy headers configuration is incorrect, or you are accessing Nextcloud from a trusted proxy. If you are not accessing Nextcloud from a trusted proxy, this is a security issue and can allow an attacker to spoof their IP address as visible to Nextcloud. Further information can be found in our <a target="_blank" rel="noreferrer" href="{docLink}">documentation</a>.', {docLink: data.reverseProxyDocs}), + msg: t('core', 'The reverse proxy headers configuration is incorrect, or you are accessing Nextcloud from a trusted proxy. If you are not accessing Nextcloud from a trusted proxy, this is a security issue and can allow an attacker to spoof their IP address as visible to Nextcloud. Further information can be found in our <a target="_blank" rel="noreferrer noopener" href="{docLink}">documentation</a>.', {docLink: data.reverseProxyDocs}), type: OC.SetupChecks.MESSAGE_TYPE_WARNING }); } if(!data.isCorrectMemcachedPHPModuleInstalled) { messages.push({ - msg: t('core', 'Memcached is configured as distributed cache, but the wrong PHP module "memcache" is installed. \\OC\\Memcache\\Memcached only supports "memcached" and not "memcache". See the <a target="_blank" rel="noreferrer" href="{wikiLink}">memcached wiki about both modules</a>.', {wikiLink: 'https://code.google.com/p/memcached/wiki/PHPClientComparison'}), + msg: t('core', 'Memcached is configured as distributed cache, but the wrong PHP module "memcache" is installed. \\OC\\Memcache\\Memcached only supports "memcached" and not "memcache". See the <a target="_blank" rel="noreferrer noopener" href="{wikiLink}">memcached wiki about both modules</a>.', {wikiLink: 'https://code.google.com/p/memcached/wiki/PHPClientComparison'}), type: OC.SetupChecks.MESSAGE_TYPE_WARNING }); } @@ -138,7 +138,7 @@ messages.push({ msg: t( 'core', - 'Some files have not passed the integrity check. Further information on how to resolve this issue can be found in our <a target="_blank" rel="noreferrer" href="{docLink}">documentation</a>. (<a href="{codeIntegrityDownloadEndpoint}">List of invalid files…</a> / <a href="{rescanEndpoint}">Rescan…</a>)', + 'Some files have not passed the integrity check. Further information on how to resolve this issue can be found in our <a target="_blank" rel="noreferrer noopener" href="{docLink}">documentation</a>. (<a href="{codeIntegrityDownloadEndpoint}">List of invalid files…</a> / <a href="{rescanEndpoint}">Rescan…</a>)', { docLink: data.codeIntegrityCheckerDocumentation, codeIntegrityDownloadEndpoint: OC.generateUrl('/settings/integrity/failed'), @@ -152,7 +152,7 @@ messages.push({ msg: t( 'core', - 'The PHP OPcache is not properly configured. <a target="_blank" rel="noreferrer" href="{docLink}">For better performance we recommend</a> to use following settings in the <code>php.ini</code>:', + 'The PHP OPcache is not properly configured. <a target="_blank" rel="noreferrer noopener" href="{docLink}">For better performance we recommend</a> to use following settings in the <code>php.ini</code>:', { docLink: data.phpOpcacheDocumentation, } @@ -248,18 +248,22 @@ if (xhr.status === 200) { var securityHeaders = { - 'X-XSS-Protection': '1; mode=block', - 'X-Content-Type-Options': 'nosniff', - 'X-Robots-Tag': 'none', - 'X-Frame-Options': 'SAMEORIGIN', - 'X-Download-Options': 'noopen', - 'X-Permitted-Cross-Domain-Policies': 'none', + 'X-XSS-Protection': ['1; mode=block'], + 'X-Content-Type-Options': ['nosniff'], + 'X-Robots-Tag': ['none'], + 'X-Frame-Options': ['SAMEORIGIN', 'DENY'], + 'X-Download-Options': ['noopen'], + 'X-Permitted-Cross-Domain-Policies': ['none'], }; - for (var header in securityHeaders) { - if(!xhr.getResponseHeader(header) || xhr.getResponseHeader(header).toLowerCase() !== securityHeaders[header].toLowerCase()) { + var option = securityHeaders[header][0]; + if(!xhr.getResponseHeader(header) || xhr.getResponseHeader(header).toLowerCase() !== option.toLowerCase()) { + var msg = t('core', 'The "{header}" HTTP header is not configured to equal to "{expected}". This is a potential security or privacy risk and we recommend adjusting this setting.', {header: header, expected: option}); + if(xhr.getResponseHeader(header) && securityHeaders[header].length > 1 && xhr.getResponseHeader(header).toLowerCase() === securityHeaders[header][1].toLowerCase()) { + msg = t('core', 'The "{header}" HTTP header is not configured to equal to "{expected}". Some features might not work correctly and we recommend adjusting this setting.', {header: header, expected: option}); + } messages.push({ - msg: t('core', 'The "{header}" HTTP header is not configured to equal to "{expected}". This is a potential security or privacy risk and we recommend adjusting this setting.', {header: header, expected: securityHeaders[header]}), + msg: msg, type: OC.SetupChecks.MESSAGE_TYPE_WARNING }); } @@ -300,7 +304,7 @@ var minimumSeconds = 15552000; if(isNaN(transportSecurityValidity) || transportSecurityValidity <= (minimumSeconds - 1)) { messages.push({ - msg: t('core', 'The "Strict-Transport-Security" HTTP header is not configured to at least "{seconds}" seconds. For enhanced security we recommend enabling HSTS as described in our <a href="{docUrl}" rel="noreferrer">security tips</a>.', {'seconds': minimumSeconds, docUrl: tipsUrl}), + msg: t('core', 'The "Strict-Transport-Security" HTTP header is not configured to at least "{seconds}" seconds. For enhanced security we recommend enabling HSTS as described in our <a href="{docUrl}" rel="noreferrer noopener">security tips</a>.', {'seconds': minimumSeconds, docUrl: tipsUrl}), type: OC.SetupChecks.MESSAGE_TYPE_WARNING }); } diff --git a/core/js/share.js b/core/js/share.js index 659d719788d..25d59b46fb4 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -203,18 +203,19 @@ OC.Share = _.extend(OC.Share || {}, { * @param {String} remoteAddress full remote share * @return {String} HTML code to display */ - _formatRemoteShare: function(remoteAddress) { + _formatRemoteShare: function(remoteAddress, message) { var parts = this._REMOTE_OWNER_REGEXP.exec(remoteAddress); if (!parts) { - // display as is, most likely to be a simple owner name - return escapeHTML(remoteAddress); + // 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> '; + return avatar + hidden; } var userName = parts[1]; var userDomain = parts[3]; var server = parts[4]; - var dir = parts[6]; - var tooltip = userName; + var tooltip = message + ' ' + userName; if (userDomain) { tooltip += '@' + userDomain; } @@ -230,7 +231,7 @@ OC.Share = _.extend(OC.Share || {}, { if (userDomain) { html += '<span class="userDomain">@' + escapeHTML(userDomain) + '</span>'; } - html += '</span>'; + html += '</span> '; return html; }, /** @@ -243,7 +244,7 @@ OC.Share = _.extend(OC.Share || {}, { _formatShareList: function(recipients) { var _parent = this; return $.map(recipients, function(recipient) { - recipient = _parent._formatRemoteShare(recipient); + recipient = _parent._formatRemoteShare(recipient, t('core', 'Shared with')); return recipient; }); }, @@ -259,8 +260,7 @@ OC.Share = _.extend(OC.Share || {}, { var action = $tr.find('.fileactions .action[data-action="Share"]'); var type = $tr.data('type'); var icon = action.find('.icon'); - var message; - var recipients; + var message, recipients, avatars; var owner = $tr.attr('data-share-owner'); var shareFolderIcon; var iconClass = 'icon-shared'; @@ -294,20 +294,23 @@ OC.Share = _.extend(OC.Share || {}, { recipients = $tr.attr('data-share-recipients'); action.addClass('shared-style'); - message = t('core', 'Shared'); + avatars = '<span>' + t('core', 'Shared') + '</span>'; // even if reshared, only show "Shared by" if (owner) { - message = this._formatRemoteShare(owner); + message = t('core', 'Shared by'); + avatars = this._formatRemoteShare(owner, message); + } else if (recipients) { + avatars = this._formatShareList(recipients.split(', ')).join(''); } - else if (recipients) { - message = t('core', 'Shared with {recipients}', {recipients: this._formatShareList(recipients.split(", ")).join(", ")}, 0, {escape: false}); - } - action.html('<span> ' + message + '</span>').prepend(icon); + action.html(avatars).prepend(icon); + if (owner || recipients) { - action.find('.remoteAddress').tooltip({placement: 'top'}); + var avatarElement = action.find('.avatar'); + avatarElement.avatar(avatarElement.data('username'), 32); + + action.find('.icon-shared + span').tooltip({placement: 'top'}); } - } - else { + } else { action.html('<span class="hidden-visually">' + t('core', 'Shared') + '</span>').prepend(icon); } if (hasLink) { diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js index d3802824fe0..b4828e3b0dc 100644 --- a/core/js/sharedialogshareelistview.js +++ b/core/js/sharedialogshareelistview.js @@ -376,7 +376,7 @@ var sharee = this.getShareeObject(shareWithIndex); $.extend(sharee, this.getShareProperties()); var $li = this.$('li[data-share-id=' + permissionChangeShareId + ']'); - $li.find('.popovermenu').replaceWith(this.popoverMenuTemplate(sharee)); + $li.find('.sharingOptionsGroup .popovermenu').replaceWith(this.popoverMenuTemplate(sharee)); var checkBoxId = 'canEdit-' + this.cid + '-' + sharee.shareWith; checkBoxId = '#' + checkBoxId.replace( /(:|\.|\[|\]|,|=|@)/g, "\\$1"); @@ -403,12 +403,12 @@ } } }); - if (this._menuOpen != false) { + if (this._menuOpen !== false) { // Open menu again if it was opened before var shareId = parseInt(this._menuOpen, 10); if(!_.isNaN(shareId)) { var liSelector = 'li[data-share-id=' + shareId + ']'; - OC.showMenu(null, this.$(liSelector + '.sharingOptionsGroup .popovermenu')); + OC.showMenu(null, this.$(liSelector + ' .sharingOptionsGroup .popovermenu')); } } diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js index dd13cba8e2b..9848fb46ffc 100644 --- a/core/js/tests/specs/coreSpec.js +++ b/core/js/tests/specs/coreSpec.js @@ -256,10 +256,10 @@ describe('Core base tests', function() { describe('filePath', function() { beforeEach(function() { OC.webroot = 'http://localhost'; - OC.appswebroots['files'] = OC.webroot + '/apps3/files'; + OC.appswebroots.files = OC.webroot + '/apps3/files'; }); afterEach(function() { - delete OC.appswebroots['files']; + delete OC.appswebroots.files; }); it('Uses a direct link for css and images,' , function() { diff --git a/core/js/tests/specs/files/clientSpec.js b/core/js/tests/specs/files/clientSpec.js index 4ab7bbfabf6..6593372144a 100644 --- a/core/js/tests/specs/files/clientSpec.js +++ b/core/js/tests/specs/files/clientSpec.js @@ -448,7 +448,7 @@ describe('OC.Files.Client tests', function() { expect(info.id).toEqual(11); // file entry - var info = response[1]; + info = response[1]; expect(info instanceof OC.Files.FileInfo).toEqual(true); expect(info.id).toEqual(51); diff --git a/core/js/tests/specs/jquery.avatarSpec.js b/core/js/tests/specs/jquery.avatarSpec.js index d7305736690..b9351d2a8a0 100644 --- a/core/js/tests/specs/jquery.avatarSpec.js +++ b/core/js/tests/specs/jquery.avatarSpec.js @@ -11,7 +11,7 @@ describe('jquery.avatar tests', function() { var $div; - var devicePixelRatio + var devicePixelRatio; beforeEach(function() { $('#testArea').append($('<div id="avatardiv">')); @@ -24,7 +24,7 @@ describe('jquery.avatar tests', function() { afterEach(function() { $div.remove(); - window.devicePixelRatio = devicePixelRatio + window.devicePixelRatio = devicePixelRatio; }); describe('size', function() { diff --git a/core/js/tests/specs/mimeTypeSpec.js b/core/js/tests/specs/mimeTypeSpec.js index 182941de1a9..8ad0300a0a7 100644 --- a/core/js/tests/specs/mimeTypeSpec.js +++ b/core/js/tests/specs/mimeTypeSpec.js @@ -26,17 +26,17 @@ describe('MimeType tests', function() { beforeEach(function() { _files = OC.MimeTypeList.files; _aliases = OC.MimeTypeList.aliases; - _theme = OC.MimeTypeList.themes['abc']; + _theme = OC.MimeTypeList.themes.abc; OC.MimeTypeList.files = ['folder', 'folder-shared', 'folder-external', 'foo-bar', 'foo', 'file']; OC.MimeTypeList.aliases = {'app/foobar': 'foo/bar'}; - OC.MimeTypeList.themes['abc'] = ['folder']; + OC.MimeTypeList.themes.abc = ['folder']; }); afterEach(function() { OC.MimeTypeList.files = _files; OC.MimeTypeList.aliases = _aliases; - OC.MimeTypeList.themes['abc'] = _theme; + OC.MimeTypeList.themes.abc = _theme; }); describe('_getFile', function() { @@ -109,9 +109,9 @@ describe('MimeType tests', function() { var res = OC.MimeType.getIconUrl('dir'); expect(Object.keys(OC.MimeType._mimeTypeIcons).length).toEqual(1); - expect(OC.MimeType._mimeTypeIcons['dir']).toEqual(res); + expect(OC.MimeType._mimeTypeIcons.dir).toEqual(res); - var res = OC.MimeType.getIconUrl('dir-shared'); + res = OC.MimeType.getIconUrl('dir-shared'); expect(Object.keys(OC.MimeType._mimeTypeIcons).length).toEqual(2); expect(OC.MimeType._mimeTypeIcons['dir-shared']).toEqual(res); }); diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index 35279f3501e..3df676099b7 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -68,7 +68,7 @@ describe('OC.SetupChecks tests', function() { async.done(function( data, s, x ){ expect(data).toEqual([{ - msg: 'Your web server is not set up properly to resolve "/.well-known/caldav/". Further information can be found in our <a href="http://example.org/admin-setup-well-known-URL" rel="noreferrer">documentation</a>.', + msg: 'Your web server is not set up properly to resolve "/.well-known/caldav/". Further information can be found in our <a href="http://example.org/admin-setup-well-known-URL" rel="noreferrer noopener">documentation</a>.', type: OC.SetupChecks.MESSAGE_TYPE_INFO }]); done(); @@ -166,7 +166,7 @@ describe('OC.SetupChecks tests', function() { msg: 'This server has no working Internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. We suggest to enable Internet connection for this server if you want to have all features.', type: OC.SetupChecks.MESSAGE_TYPE_WARNING }, { - msg: 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a href="https://docs.nextcloud.com/server/go.php?to=admin-performance" rel="noreferrer">documentation</a>.', + msg: 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a href="https://docs.nextcloud.com/server/go.php?to=admin-performance" rel="noreferrer noopener">documentation</a>.', type: OC.SetupChecks.MESSAGE_TYPE_INFO }]); done(); @@ -200,7 +200,7 @@ describe('OC.SetupChecks tests', function() { type: OC.SetupChecks.MESSAGE_TYPE_WARNING }, { - msg: 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a href="https://docs.nextcloud.com/server/go.php?to=admin-performance" rel="noreferrer">documentation</a>.', + msg: 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a href="https://docs.nextcloud.com/server/go.php?to=admin-performance" rel="noreferrer noopener">documentation</a>.', type: OC.SetupChecks.MESSAGE_TYPE_INFO }]); done(); @@ -261,7 +261,7 @@ describe('OC.SetupChecks tests', function() { async.done(function( data, s, x ){ expect(data).toEqual([{ - msg: '/dev/urandom is not readable by PHP which is highly discouraged for security reasons. Further information can be found in our <a href="https://docs.owncloud.org/myDocs.html" rel="noreferrer">documentation</a>.', + msg: '/dev/urandom is not readable by PHP which is highly discouraged for security reasons. Further information can be found in our <a href="https://docs.owncloud.org/myDocs.html" rel="noreferrer noopener">documentation</a>.', type: OC.SetupChecks.MESSAGE_TYPE_WARNING }]); done(); @@ -291,7 +291,7 @@ describe('OC.SetupChecks tests', function() { async.done(function( data, s, x ){ expect(data).toEqual([{ - msg: 'Memcached is configured as distributed cache, but the wrong PHP module "memcache" is installed. \\OC\\Memcache\\Memcached only supports "memcached" and not "memcache". See the <a href="https://code.google.com/p/memcached/wiki/PHPClientComparison" rel="noreferrer">memcached wiki about both modules</a>.', + msg: 'Memcached is configured as distributed cache, but the wrong PHP module "memcache" is installed. \\OC\\Memcache\\Memcached only supports "memcached" and not "memcache". See the <a href="https://code.google.com/p/memcached/wiki/PHPClientComparison" rel="noreferrer noopener">memcached wiki about both modules</a>.', type: OC.SetupChecks.MESSAGE_TYPE_WARNING }]); done(); @@ -321,7 +321,7 @@ describe('OC.SetupChecks tests', function() { async.done(function( data, s, x ){ expect(data).toEqual([{ - msg: 'The reverse proxy headers configuration is incorrect, or you are accessing Nextcloud from a trusted proxy. If you are not accessing Nextcloud from a trusted proxy, this is a security issue and can allow an attacker to spoof their IP address as visible to Nextcloud. Further information can be found in our <a href="https://docs.owncloud.org/foo/bar.html" rel="noreferrer">documentation</a>.', + msg: 'The reverse proxy headers configuration is incorrect, or you are accessing Nextcloud from a trusted proxy. If you are not accessing Nextcloud from a trusted proxy, this is a security issue and can allow an attacker to spoof their IP address as visible to Nextcloud. Further information can be found in our <a href="https://docs.owncloud.org/foo/bar.html" rel="noreferrer noopener">documentation</a>.', type: OC.SetupChecks.MESSAGE_TYPE_WARNING }]); done(); @@ -402,7 +402,7 @@ describe('OC.SetupChecks tests', function() { async.done(function( data, s, x ){ expect(data).toEqual([{ - msg: 'You are currently running PHP 5.4.0. We encourage you to upgrade your PHP version to take advantage of <a href="https://secure.php.net/supported-versions.php" rel="noreferrer">performance and security updates provided by the PHP Group</a> as soon as your distribution supports it.', + msg: 'You are currently running PHP 5.4.0. We encourage you to upgrade your PHP version to take advantage of <a href="https://secure.php.net/supported-versions.php" rel="noreferrer noopener">performance and security updates provided by the PHP Group</a> as soon as your distribution supports it.', type: OC.SetupChecks.MESSAGE_TYPE_INFO }]); done(); @@ -433,7 +433,7 @@ describe('OC.SetupChecks tests', function() { async.done(function( data, s, x ){ expect(data).toEqual([{ - msg: 'The PHP OPcache is not properly configured. <a href="https://example.org/link/to/doc" rel="noreferrer">For better performance we recommend</a> to use following settings in the <code>php.ini</code>:' + "<pre><code>opcache.enable=1\nopcache.enable_cli=1\nopcache.interned_strings_buffer=8\nopcache.max_accelerated_files=10000\nopcache.memory_consumption=128\nopcache.save_comments=1\nopcache.revalidate_freq=1</code></pre>", + msg: 'The PHP OPcache is not properly configured. <a href="https://example.org/link/to/doc" rel="noreferrer noopener">For better performance we recommend</a> to use following settings in the <code>php.ini</code>:' + "<pre><code>opcache.enable=1\nopcache.enable_cli=1\nopcache.interned_strings_buffer=8\nopcache.max_accelerated_files=10000\nopcache.memory_consumption=128\nopcache.save_comments=1\nopcache.revalidate_freq=1</code></pre>", type: OC.SetupChecks.MESSAGE_TYPE_INFO }]); done(); @@ -617,7 +617,7 @@ describe('OC.SetupChecks tests', function() { async.done(function( data, s, x ){ expect(data).toEqual([{ - msg: 'The "Strict-Transport-Security" HTTP header is not configured to at least "15552000" seconds. For enhanced security we recommend enabling HSTS as described in our <a rel="noreferrer" href="http://localhost/index.php/settings/admin/tips-tricks">security tips</a>.', + msg: 'The "Strict-Transport-Security" HTTP header is not configured to at least "15552000" seconds. For enhanced security we recommend enabling HSTS as described in our <a rel="noreferrer noopener" href="http://localhost/index.php/settings/admin/tips-tricks">security tips</a>.', type: OC.SetupChecks.MESSAGE_TYPE_WARNING }]); done(); @@ -642,7 +642,7 @@ describe('OC.SetupChecks tests', function() { async.done(function( data, s, x ){ expect(data).toEqual([{ - msg: 'The "Strict-Transport-Security" HTTP header is not configured to at least "15552000" seconds. For enhanced security we recommend enabling HSTS as described in our <a rel="noreferrer" href="http://localhost/index.php/settings/admin/tips-tricks">security tips</a>.', + msg: 'The "Strict-Transport-Security" HTTP header is not configured to at least "15552000" seconds. For enhanced security we recommend enabling HSTS as described in our <a rel="noreferrer noopener" href="http://localhost/index.php/settings/admin/tips-tricks">security tips</a>.', type: OC.SetupChecks.MESSAGE_TYPE_WARNING }]); done(); @@ -667,7 +667,7 @@ describe('OC.SetupChecks tests', function() { async.done(function( data, s, x ){ expect(data).toEqual([{ - msg: 'The "Strict-Transport-Security" HTTP header is not configured to at least "15552000" seconds. For enhanced security we recommend enabling HSTS as described in our <a rel="noreferrer" href="http://localhost/index.php/settings/admin/tips-tricks">security tips</a>.', + msg: 'The "Strict-Transport-Security" HTTP header is not configured to at least "15552000" seconds. For enhanced security we recommend enabling HSTS as described in our <a rel="noreferrer noopener" href="http://localhost/index.php/settings/admin/tips-tricks">security tips</a>.', type: OC.SetupChecks.MESSAGE_TYPE_WARNING }]); done(); diff --git a/core/js/tests/specs/shareSpec.js b/core/js/tests/specs/shareSpec.js index fbf6eecc8df..70c698c99a2 100644 --- a/core/js/tests/specs/shareSpec.js +++ b/core/js/tests/specs/shareSpec.js @@ -47,7 +47,7 @@ describe('OC.Share tests', function() { $file.attr('data-share-owner', input); OC.Share.markFileAsShared($file); - $action = $file.find('.action-share>span'); + $action = $file.find('.action-share>span').parent(); expect($action.text().trim()).toEqual(output); if (_.isString(title)) { expect($action.find('.remoteAddress').attr('title')).toEqual(title); @@ -58,41 +58,41 @@ describe('OC.Share tests', function() { tooltipStub.reset(); } - it('displays the local share owner as is', function() { - checkOwner('User One', 'User One', null); + it('displays the local share owner with "Shared by" prefix', function() { + checkOwner('User One', 'Shared by User One', null); }); it('displays the user name part of a remote share owner', function() { checkOwner( 'User One@someserver.com', 'User One@…', - 'User One@someserver.com' + 'Shared by User One@someserver.com' ); checkOwner( 'User One@someserver.com/', 'User One@…', - 'User One@someserver.com' + 'Shared by User One@someserver.com' ); checkOwner( 'User One@someserver.com/root/of/owncloud', 'User One@…', - 'User One@someserver.com' + 'Shared by User One@someserver.com' ); }); it('displays the user name part with domain of a remote share owner', function() { checkOwner( 'User One@example.com@someserver.com', 'User One@example.com', - 'User One@example.com@someserver.com' + 'Shared by User One@example.com@someserver.com' ); checkOwner( 'User One@example.com@someserver.com/', 'User One@example.com', - 'User One@example.com@someserver.com' + 'Shared by User One@example.com@someserver.com' ); checkOwner( 'User One@example.com@someserver.com/root/of/owncloud', 'User One@example.com', - 'User One@example.com@someserver.com' + 'Shared by User One@example.com@someserver.com' ); }); }); @@ -151,14 +151,14 @@ describe('OC.Share tests', function() { }); }); - describe('displaying the recipoients', function() { + describe('displaying the recipients', function() { function checkRecipients(input, output, title) { var $action; $file.attr('data-share-recipients', input); OC.Share.markFileAsShared($file, true); - $action = $file.find('.action-share>span'); + $action = $file.find('.action-share>span').parent(); expect($action.text().trim()).toEqual(output); if (_.isString(title)) { expect($action.find('.remoteAddress').attr('title')).toEqual(title); @@ -182,62 +182,61 @@ describe('OC.Share tests', function() { it('displays the user name part of a remote recipient', function() { checkRecipients( 'User One@someserver.com', - 'Shared with User One@…', - 'User One@someserver.com' + 'User One@…', + 'Shared with User One@someserver.com' ); checkRecipients( 'User One@someserver.com/', - 'Shared with User One@…', - 'User One@someserver.com' + 'User One@…', + 'Shared with User One@someserver.com' ); checkRecipients( 'User One@someserver.com/root/of/owncloud', - 'Shared with User One@…', - 'User One@someserver.com' + 'User One@…', + 'Shared with User One@someserver.com' ); }); it('displays the user name part with domain of a remote share owner', function() { checkRecipients( 'User One@example.com@someserver.com', - 'Shared with User One@example.com', - 'User One@example.com@someserver.com' + 'User One@example.com', + 'Shared with User One@example.com@someserver.com' ); checkRecipients( 'User One@example.com@someserver.com/', - 'Shared with User One@example.com', - 'User One@example.com@someserver.com' + 'User One@example.com', + 'Shared with User One@example.com@someserver.com' ); checkRecipients( 'User One@example.com@someserver.com/root/of/owncloud', - 'Shared with User One@example.com', - 'User One@example.com@someserver.com' + 'User One@example.com', + 'Shared with User One@example.com@someserver.com' ); }); it('display multiple remote recipients', function() { checkRecipients( 'One@someserver.com, two@otherserver.com', - 'Shared with One@…, two@…', - ['One@someserver.com', 'two@otherserver.com'] + 'One@… two@…', + ['Shared with One@someserver.com', 'Shared with two@otherserver.com'] ); checkRecipients( 'One@someserver.com/, two@otherserver.com', - 'Shared with One@…, two@…', - ['One@someserver.com', 'two@otherserver.com'] + 'One@… two@…', + ['Shared with One@someserver.com', 'Shared with two@otherserver.com'] ); checkRecipients( 'One@someserver.com/root/of/owncloud, two@otherserver.com', - 'Shared with One@…, two@…', - ['One@someserver.com', 'two@otherserver.com'] + 'One@… two@…', + ['Shared with One@someserver.com', 'Shared with two@otherserver.com'] ); }); it('display mixed recipients', function() { checkRecipients( 'One, two@otherserver.com', - 'Shared with One, two@…', - ['two@otherserver.com'] + 'Shared with One two@…', + ['Shared with two@otherserver.com'] ); }); }); }); }); - diff --git a/core/js/tests/specs/sharedialoglinkshareview.js b/core/js/tests/specs/sharedialoglinkshareview.js index 811919b5603..12f5e762cee 100644 --- a/core/js/tests/specs/sharedialoglinkshareview.js +++ b/core/js/tests/specs/sharedialoglinkshareview.js @@ -48,7 +48,6 @@ describe('OC.Share.ShareDialogLinkShareView', function () { configModel = new OC.Share.ShareConfigModel({ enforcePasswordForPublicLink: false, isResharingAllowed: true, - enforcePasswordForPublicLink: false, isDefaultExpireDateEnabled: false, isDefaultExpireDateEnforced: false, defaultExpireDate: 7 diff --git a/core/js/tests/specs/sharedialogshareelistview.js b/core/js/tests/specs/sharedialogshareelistview.js index bcc596a1386..8ee2c48fe39 100644 --- a/core/js/tests/specs/sharedialogshareelistview.js +++ b/core/js/tests/specs/sharedialogshareelistview.js @@ -59,7 +59,6 @@ describe('OC.Share.ShareDialogShareeListView', function () { configModel = new OC.Share.ShareConfigModel({ enforcePasswordForPublicLink: false, isResharingAllowed: true, - enforcePasswordForPublicLink: false, isDefaultExpireDateEnabled: false, isDefaultExpireDateEnforced: false, defaultExpireDate: 7 @@ -123,20 +122,6 @@ describe('OC.Share.ShareDialogShareeListView', function () { expect(listView.$el.find("input[name='edit']").is(':checked')).toEqual(true); expect(updateShareStub.calledOnce).toEqual(true); }); - - it('shows cruds checkboxes when toggled', function () { - shareModel.set('shares', [{ - id: 100, - item_source: 123, - permissions: 1, - share_type: OC.Share.SHARE_TYPE_USER, - share_with: 'user1', - share_with_displayname: 'User One' - }]); - listView.render(); - listView.$el.find('a.showCruds').click(); - expect(listView.$el.find('li.cruds').hasClass('hidden')).toEqual(false); - }); }); }); diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js index 95349bc4875..c6d5793623c 100644 --- a/core/js/tests/specs/sharedialogviewSpec.js +++ b/core/js/tests/specs/sharedialogviewSpec.js @@ -67,7 +67,6 @@ describe('OC.Share.ShareDialogView', function() { configModel = new OC.Share.ShareConfigModel({ enforcePasswordForPublicLink: false, isResharingAllowed: true, - enforcePasswordForPublicLink: false, isDefaultExpireDateEnabled: false, isDefaultExpireDateEnforced: false, defaultExpireDate: 7 |