diff options
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/share.js | 2 | ||||
-rw-r--r-- | core/js/tests/specs/shareSpec.js | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/core/js/share.js b/core/js/share.js index b8cc74fdc61..d8930727cfd 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -356,7 +356,7 @@ OC.Share={ var data = OC.Share.loadItem(itemType, itemSource); var dropDownEl; var html = '<div id="dropdown" class="drop shareDropDown" data-item-type="'+itemType+'" data-item-source="'+itemSource+'">'; - if (data !== false && data.reshare !== false && data.reshare.uid_owner !== undefined) { + if (data !== false && data.reshare !== false && data.reshare.uid_owner !== undefined && data.reshare.uid_owner !== OC.currentUser) { if (data.reshare.share_type == OC.Share.SHARE_TYPE_GROUP) { html += '<span class="reshare">'+t('core', 'Shared with you and the group {group} by {owner}', {group: data.reshare.share_with, owner: data.reshare.displayname_owner})+'</span>'; } else { diff --git a/core/js/tests/specs/shareSpec.js b/core/js/tests/specs/shareSpec.js index 90cc77120db..ffde885d2b6 100644 --- a/core/js/tests/specs/shareSpec.js +++ b/core/js/tests/specs/shareSpec.js @@ -26,6 +26,7 @@ describe('OC.Share tests', function() { var oldAppConfig; var loadItemStub; var autocompleteStub; + var oldCurrentUser; beforeEach(function() { $('#testArea').append($('<div id="shareContainer"></div>')); @@ -54,8 +55,13 @@ describe('OC.Share tests', function() { var $el = $('<div></div>').data('ui-autocomplete', {}); return $el; }); + + + oldCurrentUser = OC.currentUser; + OC.currentUser = 'user0'; }); afterEach(function() { + OC.currentUser = oldCurrentUser; /* jshint camelcase:false */ oc_appconfig.core = oldAppConfig; loadItemStub.restore(); @@ -683,6 +689,26 @@ describe('OC.Share tests', function() { ); expect($('#dropdown #shareWithList').length).toEqual(0); }); + it('allows owner to share their own share when they are also the recipient', function() { + OC.currentUser = 'user1'; + loadItemStub.returns({ + reshare: { + permissions: OC.PERMISSION_READ, + uid_owner: 'user1' + }, + shares: [] + }); + OC.Share.showDropDown( + 'file', + 123, + $container, + true, + OC.PERMISSION_ALL, + 'shared_file_name.txt' + ); + // sharing still allowed + expect($('#dropdown #shareWithList').length).toEqual(1); + }); }); }); }); |