summaryrefslogtreecommitdiffstats
path: root/apps/files/js/filelist.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/js/filelist.js')
-rw-r--r--apps/files/js/filelist.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index b1e7c3f5f8c..086e148e102 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -1566,11 +1566,16 @@
this._sort = sort;
this._sortDirection = (direction === 'desc')?'desc':'asc';
this._sortComparator = function(fileInfo1, fileInfo2) {
- if(fileInfo1.isFavorite && !fileInfo2.isFavorite) {
+ var isFavorite = function(fileInfo) {
+ return fileInfo.tags && fileInfo.tags.indexOf(OC.TAG_FAVORITE) >= 0;
+ };
+
+ if (isFavorite(fileInfo1) && !isFavorite(fileInfo2)) {
return -1;
- } else if(!fileInfo1.isFavorite && fileInfo2.isFavorite) {
+ } else if (!isFavorite(fileInfo1) && isFavorite(fileInfo2)) {
return 1;
}
+
return direction === 'asc' ? comparator(fileInfo1, fileInfo2) : -comparator(fileInfo1, fileInfo2);
};