Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sharing subtab headers if no link share is allowed #27708

Merged
merged 1 commit into from
May 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions core/js/sharedialogview.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
var TEMPLATE_BASE =
'<div class="resharerInfoView subView"></div>' +
'{{#if isSharingAllowed}}' +
'{{#if isLinkSharingAllowed}}' +
'<ul class="subTabHeaders">' +
' <li class="subTabHeader selected subtab-localshare">{{localSharesLabel}}</li>' +
' <li class="subTabHeader subtab-publicshare">{{publicSharesLabel}}</li>' +
'</ul>' +
'{{/if}}' +
'<div class="tabsContainer">' +
// TODO: this really should be a separate view class
' <div class="localShareView tab" style="padding-left:0;padding-right:0;">' +
Expand Down Expand Up @@ -378,6 +380,7 @@
sharePlaceholder: this._renderSharePlaceholderPart(),
remoteShareInfo: this._renderRemoteShareInfoPart(),
isSharingAllowed: this.model.sharePermissionPossible(),
isLinkSharingAllowed: this.configModel.isShareWithLinkAllowed(),
localSharesLabel: t('core', 'User and Groups'),
publicSharesLabel: t('core', 'Public Links'),
noSharingPlaceholder: t('core', 'Resharing is not allowed')
Expand Down
9 changes: 9 additions & 0 deletions core/js/tests/specs/sharedialogviewSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,15 @@ describe('OC.Share.ShareDialogView', function() {
expect(dialog.$('.subTabHeaders').length).toEqual(0);
expect(dialog.$('.tabsContainer').length).toEqual(0);
});
it('does not render tab headers is link sharing is not allowed', function() {
$('#allowShareWithLink').val('no');

dialog.render();

// only hide headers
expect(dialog.$('.subTabHeaders').length).toEqual(0);
expect(dialog.$('.tabsContainer').length).toEqual(1);
});
it('initially selects first tab', function() {
expect(dialog.$('.subTabHeaders>.subTabHeader:eq(0)').hasClass('selected')).toEqual(true);
expect(dialog.$('.subTabHeaders>.subTabHeader:eq(1)').hasClass('selected')).toEqual(false);
Expand Down