Merge pull request #21009 from owncloud/share-forbidlinkshare-duplicatefield

Fix duplicate bogus share field when link sharing is not allowed
This commit is contained in:
Thomas Müller 2015-12-07 17:49:24 +01:00
commit 77958bb601
2 changed files with 10 additions and 6 deletions

View file

@ -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;
}

View file

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