Merge pull request #12187 from nextcloud/stable14-12163
[stable14] Do not set indeterminate state for file shares
This commit is contained in:
commit
5bb7378bf3
|
@ -460,8 +460,10 @@
|
||||||
var $edit = _this.$('#canEdit-' + _this.cid + '-' + sharee.shareId);
|
var $edit = _this.$('#canEdit-' + _this.cid + '-' + sharee.shareId);
|
||||||
if($edit.length === 1) {
|
if($edit.length === 1) {
|
||||||
$edit.prop('checked', sharee.editPermissionState === 'checked');
|
$edit.prop('checked', sharee.editPermissionState === 'checked');
|
||||||
|
if (sharee.isFolder) {
|
||||||
$edit.prop('indeterminate', sharee.editPermissionState === 'indeterminate');
|
$edit.prop('indeterminate', sharee.editPermissionState === 'indeterminate');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this.$('.popovermenu').on('afterHide', function() {
|
this.$('.popovermenu').on('afterHide', function() {
|
||||||
_this._menuOpen = false;
|
_this._menuOpen = false;
|
||||||
|
|
|
@ -614,6 +614,12 @@
|
||||||
var hcp = this.hasCreatePermission(shareIndex);
|
var hcp = this.hasCreatePermission(shareIndex);
|
||||||
var hup = this.hasUpdatePermission(shareIndex);
|
var hup = this.hasUpdatePermission(shareIndex);
|
||||||
var hdp = this.hasDeletePermission(shareIndex);
|
var hdp = this.hasDeletePermission(shareIndex);
|
||||||
|
if (this.isFile()) {
|
||||||
|
if (hcp || hup || hdp) {
|
||||||
|
return 'checked';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
if (!hcp && !hup && !hdp) {
|
if (!hcp && !hup && !hdp) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,37 @@ describe('OC.Share.ShareDialogShareeListView', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Sets correct initial checkbox state', function () {
|
describe('Sets correct initial checkbox state', function () {
|
||||||
|
|
||||||
|
it('marks edit box as unchecked for file shares without edit permissions', function () {
|
||||||
|
shareModel.set('shares', [{
|
||||||
|
id: 100,
|
||||||
|
item_source: 123,
|
||||||
|
permissions: 1,
|
||||||
|
share_type: OC.Share.SHARE_TYPE_USER,
|
||||||
|
share_with: 'user1',
|
||||||
|
share_with_displayname: 'User One',
|
||||||
|
uid_owner: oc_current_user,
|
||||||
|
itemType: 'file'
|
||||||
|
}]);
|
||||||
|
listView.render();
|
||||||
|
expect(listView.$el.find("input[name='edit']").is(':not(:checked)')).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('marks edit box as checked for file shares', function () {
|
||||||
|
shareModel.set('shares', [{
|
||||||
|
id: 100,
|
||||||
|
item_source: 123,
|
||||||
|
permissions: 1 | OC.PERMISSION_UPDATE,
|
||||||
|
share_type: OC.Share.SHARE_TYPE_USER,
|
||||||
|
share_with: 'user1',
|
||||||
|
share_with_displayname: 'User One',
|
||||||
|
uid_owner: oc_current_user,
|
||||||
|
itemType: 'file'
|
||||||
|
}]);
|
||||||
|
listView.render();
|
||||||
|
expect(listView.$el.find("input[name='edit']").is(':checked')).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
it('marks edit box as indeterminate when only some permissions are given', function () {
|
it('marks edit box as indeterminate when only some permissions are given', function () {
|
||||||
shareModel.set('shares', [{
|
shareModel.set('shares', [{
|
||||||
id: 100,
|
id: 100,
|
||||||
|
|
Loading…
Reference in New Issue