Skip to content
Snippets Groups Projects
Commit 6735005b authored by Vincent Petry's avatar Vincent Petry
Browse files

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.
parent e4c5bf79
No related branches found
No related tags found
No related merge requests found
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
' {{/if}}' + ' {{/if}}' +
'{{else}}' + '{{else}}' +
// FIXME: this doesn't belong in this view // 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}}' '{{/if}}'
; ;
...@@ -238,15 +238,18 @@ ...@@ -238,15 +238,18 @@
render: function() { render: function() {
var linkShareTemplate = this.template(); var linkShareTemplate = this.template();
var resharingAllowed = this.model.sharePermissionPossible();
if( !this.model.sharePermissionPossible() if(!resharingAllowed
|| !this.showLink || !this.showLink
|| !this.configModel.isShareWithLinkAllowed()) || !this.configModel.isShareWithLinkAllowed())
{ {
this.$el.html(linkShareTemplate({ var templateData = {shareAllowed: false};
shareAllowed: false, if (!resharingAllowed) {
noSharingPlaceholder: t('core', 'Resharing is not allowed') // add message
})); templateData.noSharingPlaceholder = t('core', 'Resharing is not allowed');
}
this.$el.html(linkShareTemplate(templateData));
return this; return this;
} }
......
...@@ -218,6 +218,7 @@ describe('OC.Share.ShareDialogView', function() { ...@@ -218,6 +218,7 @@ describe('OC.Share.ShareDialogView', function() {
dialog.render(); dialog.render();
expect(dialog.$el.find('.linkCheckbox').length).toEqual(0); 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() { it('shows populated link share when a link share exists', function() {
// this is how the OC.Share class does it... // this is how the OC.Share class does it...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment