diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-11-20 16:53:32 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-11-26 12:14:35 +0100 |
commit | 9c86665ef400b82487f48374bf11bbe6628cbe28 (patch) | |
tree | 0a8b0f7663f0f920235fe0874fa11339eca49767 /apps/files | |
parent | 4321d7522e66f387351f6721a1380081ef2c78df (diff) | |
download | nextcloud-server-9c86665ef400b82487f48374bf11bbe6628cbe28.tar.gz nextcloud-server-9c86665ef400b82487f48374bf11bbe6628cbe28.zip |
Dont show the delete button for selected files if one of the selected files is not deletable
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/js/filelist.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index bec0155e90e..6ffc10cdcbd 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -526,7 +526,8 @@ mimetype: $el.attr('data-mime'), type: $el.attr('data-type'), size: parseInt($el.attr('data-size'), 10), - etag: $el.attr('data-etag') + etag: $el.attr('data-etag'), + permissions: parseInt($el.attr('data-permissions'), 10) }; }, @@ -1636,7 +1637,7 @@ this.$el.find('.selectedActions').addClass('hidden'); } else { - canDelete = (this.getDirectoryPermissions() & OC.PERMISSION_DELETE); + canDelete = (this.getDirectoryPermissions() & OC.PERMISSION_DELETE) && this.isSelectedDeletable(); this.$el.find('.selectedActions').removeClass('hidden'); this.$el.find('#headerSize a>span:first').text(OC.Util.humanFileSize(summary.totalSize)); var selection = ''; @@ -1657,6 +1658,15 @@ }, /** + * Check whether all selected files are deletable + */ + isSelectedDeletable: function() { + return _.reduce(this.getSelectedFiles(), function(deletable, file) { + return deletable && (file.permissions & OC.PERMISSION_DELETE); + }, true); + }, + + /** * Returns whether all files are selected * @return true if all files are selected, false otherwise */ |