Summary | Folder dropdown sorted incorrectly |
Queue | IMP |
Queue Version | 4.0.1 |
Type | Bug |
State | Resolved |
Priority | 1. Low |
Owners | slusarz (at) horde (dot) org |
Requester | alex (at) milivojevic (dot) org |
Created | 02/01/2005 (7563 days ago) |
Due | |
Updated | 02/08/2005 (7556 days ago) |
Assigned | 02/04/2005 (7560 days ago) |
Resolved | 02/07/2005 (7557 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
State ⇒ Resolved
(As for
#2, there are several cases that your patch will do unneededcomparisions while the committed code won't - for example, consider
the comparision of two mailboxes 'INBOX.foo1' and 'INBOX.foo2' )
uppercase, if it is the case, than string comparation should be case
sensitive for both this check and the previously existing check for
INBOX folder itself at the beggining of fucntion).
As for 1 (speed improvement), it is dependent on IMAP server used, and
the way user organized his folders. On Cyrus with alternate_namespace
turned off, I clearly see the benefit and performance improvement. On
everything else, hm, it's doubtfull. If alternate_namespace is turned
on, and user has a flat folder structure (for example, only top-level
folders: INBOX, Folder1, Folder2, and so on), it will be actually
slower. In that case you only introduced one additional
if($this->_sortinbox && ($i == 0)) check, case that is already checked
at the beggining of function.
Anyhow, your patch worked for me. If you commit it, maybe replace
[$i] with [0]. $i is always zero in that part of code (because of
"if" statement). Or using full folder name instead of array component
(like in my patch, is there case insensitive version of strpos?).
State ⇒ Feedback
http://cvs.horde.org/diff.php/framework/IMAP/IMAP/Sort.php?r1=1.7&r2=1.8&ty=u
It is similar to what you proposed with several enhancements. 1) it is
more efficient as the INBOX folder searching code is not evauated on
every function call, and 2) it correctly searches for the
case-insensitive inbox string instead of exclusively for 'INBOX'.
If this works for you, I will commit to Horde 3.0.3.
New Attachment: folder_dropdown.patch
horde-3.0.2/lib/Horde/IMAP/Sort.php. When sorting, it checks only if
one of the arguments is INBOX itself. Folders that are subfolders of
INBOX are sorted just like any other folders (ignoring _sortinbox
setting).
The attached patch fixes this. Even when using namespace or similar
options, this should be good thing to do. Sorted list will contain
INBOX, than subfolders of INBOX (with INBOX. part displayed or hidden,
depending on used options), and than all other folders. In some
cases, this might result in the folder list that might not look
completely sorted on the first look, but it will be more logical
(because user's folders will not be mixed with shared or other users
folders).
box that contains folder listing. Example would be dropdown boxes
used in Server and Folder Information preferences dialogs. I guess
same code is used to generate those dropdown boxes.
State ⇒ Assigned
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ Folder dropdown sorted incorrectly
Queue ⇒ IMP
State ⇒ Unconfirmed
is still present in the current version of IMP, 4.0.1.
On my testing Cyrus IMAPD server, I created following mailbox
structure on the Cyrus IMAPD server for testing shared mailboxes (as
printed by cyradm's listmailbox command):
bureq (\HasNoChildren)
shared.foobar (\HasNoChildren)
user.amilivojevic (\HasChildren)
user.amilivojevic.Drafts (\HasNoChildren)
user.amilivojevic.Sent Items (\HasNoChildren)
user.amilivojevic.Spam (\HasNoChildren)
user.amilivojevic.Templates (\HasNoChildren)
user.foobar (\HasChildren)
user.foobar.shared (\HasNoChildren)
user.foobar.shared-to-all (\HasNoChildren)
user.user2 (\HasChildren)
user.user2.shr (\HasNoChildren)
user.amilivojevic is my INBOX folder. bureq and shared.* folders are,
well, shared folders. Some of the other user's folders inside user
are also shared (folders with names ending with shared, shared-to-all,
and shr).
The alternate namespace on Cyrus IMAPD is turned off. In IMP's
servers.php, folders and namespace are set to empty strings (I do want
users to see folders as subfolders of INBOX, since that is the way
their "normal" mail clients are set up).
There were two problems with folder dropdown list. The first one
seems to be solved in current version (user top-level folder was not
displayed).
The second problem is still present. The sorting is incorrect.
Dropdown box looks like this:
INBOX
bureq
Drafts
Sent Items
Spam
Templates
shared.
foobar
user.
foobar.
shared
shared-to-all
user2.
shr
Clearly, this is not correct display. Subfolders of INBOX are
displayed as if they were subfolders of top-level "bureq" folder.
If I expand the list of folders on the left pane, than I get correct
sorting and indentation. The bug seems to be present only in the
dropdown box that is located in the upper right corner of the page.
BTW, would it be possible to have non-selectable mailboxes rendered in
different style (in left pane) and non-selectable in dropdown box?
For example, top-level user and shared, as well as user.foobar and
user.user2 are not selectable when I'm connected to Cyrus IMAPD as
amilivojevic (for example, Mozilla Thunderbird renders those folders
in grey, not allowing me to select them).