]> source.dussan.org Git - nextcloud-server.git/commitdiff
Dont show the delete button for selected files if one of the selected files is not...
authorRobin Appelman <icewind@owncloud.com>
Thu, 20 Nov 2014 15:53:32 +0000 (16:53 +0100)
committerMorris Jobke <hey@morrisjobke.de>
Wed, 10 Dec 2014 07:24:31 +0000 (08:24 +0100)
apps/files/js/filelist.js

index d08e77f5a5accfc990ea104dba536e167b979196..ebdf32ee44b16e8a0920075438577cb4002aa04a 100644 (file)
                                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)
                        };
                },
 
                                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 = '';
                        }
                },
 
+               /**
+                * 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