summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-11-01 12:12:36 +0100
committerGitHub <noreply@github.com>2018-11-01 12:12:36 +0100
commit0a61242c8520a5261a8f239be90998b7682a7214 (patch)
treefc708838eff2d099c2f433938c7f96f8d7cfe963 /core
parent0247a0d6dbdb0ddb897b85ae46f095805c54d981 (diff)
parent95e34407bf07fbcb2d1a3d362e7685977f85f8d5 (diff)
downloadnextcloud-server-0a61242c8520a5261a8f239be90998b7682a7214.tar.gz
nextcloud-server-0a61242c8520a5261a8f239be90998b7682a7214.zip
Merge pull request #12163 from nextcloud/bugfix/11730/file-share-edit-state
Do not set indeterminate state for file shares
Diffstat (limited to 'core')
-rw-r--r--core/js/sharedialogshareelistview.js4
-rw-r--r--core/js/shareitemmodel.js6
-rw-r--r--core/js/tests/specs/sharedialogshareelistview.js31
3 files changed, 40 insertions, 1 deletions
diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js
index 93373a54435..94abf55a358 100644
--- a/core/js/sharedialogshareelistview.js
+++ b/core/js/sharedialogshareelistview.js
@@ -314,7 +314,9 @@
var $edit = _this.$('#canEdit-' + _this.cid + '-' + sharee.shareId);
if($edit.length === 1) {
$edit.prop('checked', sharee.editPermissionState === 'checked');
- $edit.prop('indeterminate', sharee.editPermissionState === 'indeterminate');
+ if (sharee.isFolder) {
+ $edit.prop('indeterminate', sharee.editPermissionState === 'indeterminate');
+ }
}
});
this.$('.popovermenu').on('afterHide', function() {
diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js
index 3f92a8591e5..84715ec87c1 100644
--- a/core/js/shareitemmodel.js
+++ b/core/js/shareitemmodel.js
@@ -616,6 +616,12 @@
var hcp = this.hasCreatePermission(shareIndex);
var hup = this.hasUpdatePermission(shareIndex);
var hdp = this.hasDeletePermission(shareIndex);
+ if (this.isFile()) {
+ if (hcp || hup || hdp) {
+ return 'checked';
+ }
+ return '';
+ }
if (!hcp && !hup && !hdp) {
return '';
}
diff --git a/core/js/tests/specs/sharedialogshareelistview.js b/core/js/tests/specs/sharedialogshareelistview.js
index 8e34225d199..e51fc2df72d 100644
--- a/core/js/tests/specs/sharedialogshareelistview.js
+++ b/core/js/tests/specs/sharedialogshareelistview.js
@@ -90,6 +90,37 @@ describe('OC.Share.ShareDialogShareeListView', 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 () {
shareModel.set('shares', [{
id: 100,