[Pkg-owncloud-commits] [owncloud] 40/107: Fix duplicate bogus share field when link sharing is not allowed

David Prévot taffit at moszumanska.debian.org
Thu Dec 17 19:40:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 66f11f461f64c57d2589ef11a2382da16f5dc939
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Mon Dec 7 16:53:56 2015 +0100

    Fix duplicate bogus share field when link sharing is not allowed
    
    Whenever link share is not allowed, it was outputting a bogus sharing
    field which name would conflict with the regular sharing field.
    
    This fix makes sure that the bogus sharing field with "Resharing not
    allowed" message only appears when triggered by removed share
    permissions.
---
 core/js/sharedialoglinkshareview.js        | 15 +++++++++------
 core/js/tests/specs/sharedialogviewSpec.js |  1 +
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js
index 29dce21..452599f 100644
--- a/core/js/sharedialoglinkshareview.js
+++ b/core/js/sharedialoglinkshareview.js
@@ -48,7 +48,7 @@
 			'    {{/if}}' +
 			'{{else}}' +
 			// FIXME: this doesn't belong in this view
-			'<input id="shareWith-{{cid}}" class="shareWithField" type="text" placeholder="{{noSharingPlaceholder}}" disabled="disabled"/>' +
+			'{{#if noSharingPlaceholder}}<input id="shareWith-{{cid}}" class="shareWithField" type="text" placeholder="{{noSharingPlaceholder}}" disabled="disabled"/>{{/if}}' +
 			'{{/if}}'
 		;
 
@@ -238,15 +238,18 @@
 
 		render: function() {
 			var linkShareTemplate = this.template();
+			var resharingAllowed = this.model.sharePermissionPossible();
 
-			if(    !this.model.sharePermissionPossible()
+			if(!resharingAllowed
 				|| !this.showLink
 				|| !this.configModel.isShareWithLinkAllowed())
 			{
-				this.$el.html(linkShareTemplate({
-					shareAllowed: false,
-					noSharingPlaceholder: t('core', 'Resharing is not allowed')
-				}));
+				var templateData = {shareAllowed: false};
+				if (!resharingAllowed) {
+					// add message
+					templateData.noSharingPlaceholder = t('core', 'Resharing is not allowed');
+				}
+				this.$el.html(linkShareTemplate(templateData));
 				return this;
 			}
 
diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js
index 6d19b5e..a5d726d 100644
--- a/core/js/tests/specs/sharedialogviewSpec.js
+++ b/core/js/tests/specs/sharedialogviewSpec.js
@@ -218,6 +218,7 @@ describe('OC.Share.ShareDialogView', function() {
 			dialog.render();
 
 			expect(dialog.$el.find('.linkCheckbox').length).toEqual(0);
+			expect(dialog.$el.find('.shareWithField').length).toEqual(1);
 		});
 		it('shows populated link share when a link share exists', function() {
 			// this is how the OC.Share class does it...

-- 
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