[Pkg-owncloud-commits] [owncloud] 15/131: Do not show static share owner if not available
David Prévot
taffit at moszumanska.debian.org
Tue Aug 11 15:58:26 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v8.1.1
in repository owncloud.
commit c04beb0bad0f783c0783dd4ad222718009061388
Author: Vincent Petry <pvince81 at owncloud.com>
Date: Thu Jul 2 16:38:20 2015 +0200
Do not show static share owner if not available
In some corner cases, an outgoing share exists but sharing is not
allowed for the current user. This would cause the file list to break
because the static text could not be rendered as the owner was
undefined.
---
apps/files_sharing/js/share.js | 2 +-
apps/files_sharing/tests/js/shareSpec.js | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index 11c3170..0c7d5f3 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -151,7 +151,7 @@
var permissions = $tr.data('permissions');
var hasLink = !!(shareStatus && shareStatus.link);
OC.Share.markFileAsShared($tr, true, hasLink);
- if ((permissions & OC.PERMISSION_SHARE) === 0) {
+ if ((permissions & OC.PERMISSION_SHARE) === 0 && $tr.attr('data-share-owner')) {
// if no share action exists because the admin disabled sharing for this user
// we create a share notification action to inform the user about files
// shared with him otherwise we just update the existing share action.
diff --git a/apps/files_sharing/tests/js/shareSpec.js b/apps/files_sharing/tests/js/shareSpec.js
index 1b1e363..1bbf4ff 100644
--- a/apps/files_sharing/tests/js/shareSpec.js
+++ b/apps/files_sharing/tests/js/shareSpec.js
@@ -206,6 +206,23 @@ describe('OCA.Sharing.Util tests', function() {
expect(OC.basename(getImageUrl($tr.find('.filename .thumbnail')))).toEqual('folder-shared.svg');
expect($action.find('img').length).toEqual(1);
});
+ it('do not show static share text when share exists but neither permission nor owner is available', function() {
+ var $action, $tr;
+ fileList.setFiles([{
+ id: 1,
+ type: 'dir',
+ name: 'One',
+ path: '/subdir',
+ mimetype: 'text/plain',
+ size: 12,
+ permissions: OC.PERMISSION_CREATE,
+ etag: 'abc'
+ }]);
+ $tr = fileList.$el.find('tbody tr:first');
+ expect($tr.find('.action-share').length).toEqual(0);
+ $action = $tr.find('.action-share-notification');
+ expect($action.length).toEqual(0);
+ });
});
describe('Share action', function() {
var showDropDownStub;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list