[Pkg-owncloud-commits] [owncloud] 10/90: Dont show the delete button for selected files if one of the selected files is not deletable

David Prévot taffit at moszumanska.debian.org
Fri Feb 6 21:10:40 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 3720ba931802fb75f84eb928d0a742dee8a28327
Author: Robin Appelman <icewind at owncloud.com>
Date:   Thu Nov 20 16:53:32 2014 +0100

    Dont show the delete button for selected files if one of the selected files is not deletable
---
 apps/files/js/filelist.js | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index d08e77f..ebdf32e 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -479,7 +479,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)
 			};
 		},
 
@@ -1562,7 +1563,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 = '';
@@ -1583,6 +1584,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
 		 */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list