nextcloud-server/apps/files/js
Daniel Calviño Sánchez be56374c51 Fix sorting of favorite files
The sort comparator checks the "isFavorite" property of the FileInfo
objects to compare. That property is set when the file list is loaded
and the response from the server is parsed, and thus a freshly loaded
file list has the proper sorting for favorite files. However, the
property is not set in other cases, like when the FileInfo objects are
derived from FileInfoModels due to a file being marked as a favorite or
a text editor being closed, which causes the file to be sorted in the
wrong position.

There is no need to add the property in those situations, though; in all
cases the TagsPlugin adds a "tags" array property that contains an
OC.TAG_FAVORITE tag, so that tag can be checked instead of "isFavorite".
Moreover, although "isFavorite" was added by the main "_parseFileInfo"
function it did not really belong there but to the "FileInfoParser" from
the TagsPlugin; however, as that property now is not used anywhere it
was removed altogether.

A cleaner solution would have been to make the sort comparator
extensible by plugins like other behaviours of the file list and then
add the sorting logic related to favorite files to the TagsPlugin.
However, right now only the TagsPlugin would need to alter the main
sorting logic, and it seems like a corner case anyway. Even if it is
implemented as a plugin, favorite files is a core feature, so for the
time being it will be taken into account directly in the main sorting
logic; making the sort comparator extensible by plugins is defered until
there are other use cases for that.

Fixes #5410

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2017-07-05 15:01:23 +07:00
..
templates
admin.js
app.js Put the quota bar to the bottom 2017-06-13 11:17:45 +07:00
breadcrumb.js
detailfileinfoview.js
detailsview.js Make possible to know the registered detail views in a details view 2017-06-09 03:14:23 +07:00
detailtabview.js
favoritesfilelist.js properly reload favorites list 2017-04-21 14:20:34 +07:00
favoritesplugin.js
file-upload.js Fix uploadrate value of 'original-title' attribute 2017-06-16 15:35:51 +07:00
fileactions.js
fileactionsmenu.js
fileinfomodel.js added quit option in commentstabview.js 2017-03-23 13:12:29 +07:00
filelist.js Fix sorting of favorite files 2017-07-05 15:01:23 +07:00
files.js Fix #5349, no themed icon when dragging folder 2017-06-13 17:11:05 +07:00
filesummary.js
gotoplugin.js Fix closing details view when viewing file in folder 2017-04-25 17:45:42 +07:00
jquery-visibility.js
jquery.fileupload.js
keyboardshortcuts.js
mainfileinfodetailview.js Trigger pre and post render events in MainFileInfoDetailsView 2017-06-09 08:43:53 +07:00
merged-index.json Merge file view JS files 2017-03-24 19:42:22 +07:00
navigation.js Only set the active item when there is one (not the case for quota) 2017-06-13 11:17:44 +07:00
newfilemenu.js Make new file file tooltip error text change 2017-05-21 08:23:17 +07:00
recentfilelist.js
recentplugin.js
search.js Use proper mime icons for search results 2017-05-16 14:30:49 +07:00
sidebarpreviewmanager.js
sidebarpreviewtext.js
tagsplugin.js share api expanded by tags (#26583) 2017-04-11 11:54:13 +07:00
upload.js