From 2139a031e706e256eee1e4f8cfc6cea06cf8cb9f Mon Sep 17 00:00:00 2001
From: Robin Appelman <robin@icewind.nl>
Date: Fri, 22 Jul 2016 14:19:04 +0200
Subject: [PATCH] block user sorting in recent files

---
 apps/files/js/filelist.js       | 7 ++++++-
 apps/files/js/recentfilelist.js | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index f0b16a57886..24cccb3a5c8 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -174,6 +174,11 @@
 		 */
 		_clientSideSort: true,
 
+		/**
+		 * Whether or not users can change the sort attribute or direction
+		 */
+		_allowSorting: true,
+
 		/**
 		 * Current directory
 		 * @type String
@@ -718,7 +723,7 @@
 				$target = $target.closest('a');
 			}
 			sort = $target.attr('data-sort');
-			if (sort) {
+			if (sort && this._allowSorting) {
 				if (this._sort === sort) {
 					this.setSort(sort, (this._sortDirection === 'desc')?'asc':'desc', true, true);
 				}
diff --git a/apps/files/js/recentfilelist.js b/apps/files/js/recentfilelist.js
index e63a71f8549..e8c61cbfe2d 100644
--- a/apps/files/js/recentfilelist.js
+++ b/apps/files/js/recentfilelist.js
@@ -28,6 +28,7 @@ $(document).ready(function () {
 				direction: 'desc'
 			};
 			this.initialize($el, options);
+			this._allowSorting = false;
 		};
 		RecentFileList.prototype = _.extend({}, OCA.Files.FileList.prototype,
 			/** @lends OCA.Files.RecentFileList.prototype */ {
-- 
GitLab