cryptee / web-client

Cryptee's web client source code for all platforms.
https://crypt.ee
Other
444 stars 22 forks source link

"Sort by Format" Reverse Alphabetizes Subfolders. #140

Closed PreciselyPixels closed 2 years ago

PreciselyPixels commented 2 years ago

Describe the bug When sorting by format, sub-folders are in the opposite sort order than what is selected. For example, if "Sort by format, a-z" is selected, all of the sub-folders will be listed in z-a order.

To Reproduce Enter a top level folder that has sub-folders. Set the sorting option to "sort by format". Observe as all of the folders are listed opposite to what alphabetical order you have selected.

Expected behavior Sub-folders should be correctly sorted as according to the alphabetization setting.

Screenshots

firefox_w9LDIdZ6ro

firefox_pp580glvnN

System Information (please complete the following information):

johnozbay commented 2 years ago

Hi there!

Thanks a million for filing this! I think I already know what's causing this. While trying to fix another bug related to sorting we accidentally broke this.

I've marked this in our internal tracker, and we should have a fix for this out with the next release.

PreciselyPixels commented 2 years ago

I did some more messing around with the sorting and found that "Sort by Format" doesn't affect files within their categories either. Regardless of what is set, a group of PDF files or regular documents (for example) will always be sorted in regular alphabetical order.

I wonder if this was the bug you were talking about, or if I just introduced another bug to the pile.

johnozbay commented 2 years ago

That's intended, and not a bug.

This behavior mimics Finder in Mac OS X for example, when you sort based on "Kind". Filetypes / Extensions are sorted A-Z or Z-A but individual files of each 'kind' are always sorted A-Z to make it easy to find the file you're looking for.

If you were to double down, and sort files amongst themselves A-Z or Z-A as well, it would make things difficult.

i.e. if you're looking for an Excel file xls that starts with "D" (for "December Budget.xls" let's say) you'd select Z-A for filetypes so xls is on the top, but now you have to scroll down in reverse alphabetical order to find "December" which would be more difficult than necessary.

For the same reason it's easier for us to count the alphabet off the top of our heads forwards, but not as easy if we had to do it backwards.


The bug I'm referring to which we fixed in https://github.com/cryptee/web-client/commit/13fec562257ea35b3fec08d5b3a9ec180e457f78 had to do with recently created / copied / templated documents (or copies of files which cryptee imported) appearing in wrong order inside sub-folders. We had to fix a bunch of things with our sorting algorithm in the file-explorer, and I remember we used array.reverse() somewhere to make sure things appear in the correct order. I also remember it being about creation-time and not about alphabetical order, – so might be completely unrelated – I'll have to double check. If this is the case, chances are we used one array.reverse() too many there. 😳

johnozbay commented 2 years ago

Hi there!

Just wanted to reach out and let you know that we've just released a bugfix update and this should be fixed now. Give it a try and let me know if it's better now :-)

It should behave similarly to files now, folders will always be A-Z and folders & docs should always be listed on the top no matter what, while the file extensions should be sorted A-Z or Z-A below them.

Thank you so much for your help and patience!

Best, J

PreciselyPixels commented 2 years ago

Yep, everything works as you said!