nextcloud/apps/files
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 +02:00
..
ajax share api expanded by tags (#26583) 2017-04-11 11:54:13 -05:00
appinfo Split multi-author entries 2017-05-22 10:39:49 +02:00
css Do not show icon for quota bar 2017-06-13 10:30:26 -05:00
img Do not show icon for quota bar 2017-06-13 10:30:26 -05:00
js Fix sorting of favorite files 2017-07-05 15:01:23 +02:00
l10n [tx-robot] updated from transifex 2017-07-03 00:08:21 +00:00
lib Add an event so apps can add hidden fields to the files page 2017-06-13 11:17:44 +02:00
templates Add an event so apps can add hidden fields to the files page 2017-06-13 11:17:44 +02:00
tests Fix sorting of favorite files 2017-07-05 15:01:23 +02:00
download.php Update with robin 2016-07-21 18:13:58 +02:00
list.php Remove upload_limit in files app as it is not needed with PUT upload (#26069) 2016-11-02 20:43:35 +01:00
recentlist.php Add recent file listing 2016-07-22 15:20:51 +02:00
simplelist.php Fix apps/ 2016-07-21 18:13:57 +02:00