Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mail sort order will not invert #7

Open
HenkPoley opened this issue Oct 25, 2022 · 4 comments
Open

Mail sort order will not invert #7

HenkPoley opened this issue Oct 25, 2022 · 4 comments

Comments

@HenkPoley
Copy link

I notice that if sorting is enabled (it is not in the WebMail Pro demo sadly), you can change from the default 'newest first' (arrival) sorting to the mail headers 'From:' or by 'To:'. But if you click the same item again, to invert/flip the sorting order, it will not invert the listing. Seemingly only the caret icon is flipped by CSS.

Clicking to 'From:' or 'To:' sorting will send an API request, the first time only. Inverting the sort order will not send an API request. This makes it seem like some caching issue. I've tried making the cache always send a request, but it's not fixing it / not hitting that 'fix'.

In the changelog I read that things were patched around mail sorting in 8.3.0. Has there been some unmentioned patch around this issue since then?

Any advice how to pinpoint where/why no API request is being sent on inverting the sort order? Or, if the cache decides 'it has cached everything', why the listing is not inverted on the screen?

How I enable sorting in Mail.config.json:

{
    "MessagesSortBy": [
        {
            "Allow": true,
            "List": [
                {
                    "SortBy": "arrival",
                    "LangConst": "LABEL_SORT_BY_DATE"
                },
                {
                    "SortBy": "from",
                    "LangConst": "LABEL_SORT_BY_FROM"
                },
                {
                    "SortBy": "to",
                    "LangConst": "LABEL_SORT_BY_TO"
                }
            ],
            "DefaultSortBy": "arrival",
            "DefaultSortOrder": "desc"
        },
        "array"
    ],
}
@HenkPoley
Copy link
Author

HenkPoley commented Oct 25, 2022

Added some logging, the cache in modules/MailWebclient/js/Cache.js never gets to know the sort order has changed:

CMailCache.prototype.requestMessageList = function (sFolder, iPage, sSearch, sFilters, sSortBy, iSortOrder, bCurrent, bFillMessages, bDoNotRequest)
{
	if (sFolder === 'Sent') {
		console.log('Entered CMailCache.requestMessageList, ' + sFolder + ' sorting:' + sSortBy + ' sort order:' + iSortOrder);
	}

Even if you flip the sort order, it leads to repeated:

Entered CMailCache.requestMessageList, Sent sorting:arrival sort order:1

@HenkPoley
Copy link
Author

Added some more logging, similar to the above pattern:

Entered CMessageListView.executeSort sort by:arrival
Entered CMessageListView.changeRoutingForMessageList, Sent sorting:arrival sort order:0
Entered LinksUtils.getMailbox, Sent sorting:arrival sort order:0

These are the parts of the log that do say 'sort order: 0'.

So it appears it correctly sets the URL bar of the browser. But I'm not quite sure where it sets the internal state of anything related to the mailbox view.

@HenkPoley
Copy link
Author

HenkPoley commented Oct 25, 2022

Inside modules/MailWebclient/js/utils/Links.js there is a part sTemp.substr(10).

iSortOrder = Types.pEnum(Types.pInt(sTemp.substr(10)), Enums.SortOrder, Settings.MessagesSortBy.DefaultSortOrder);

This area of the code looks at the part after the # in the URL, and chops off 'sortorder:'.

But no matter what you write after 'sortorder:' (be it 0, 1 or 'blabla'), you will end up with iSortOrder = 1. Also, I don't think this code is triggered when LinksUtils.getMailbox() sets the 'sortorder:' in the URL. So this is a bit ineffective.

But at least when I replace it with:

iSortOrder = parseInt(sTemp.substr(10)) === 0 ? 0 : 1

I can now set the sort order of the mailbox view by entering sortorder%3A0 (or sortorder:0) on the URL bar and hitting Enter.

But only by (re-)entering the URL. So this is a roundabout halfway 'fix'.

@HenkPoley
Copy link
Author

My attention/interest for ticket will be low, as the product is no longer in use by me. Decisions beyond my power 😅

Sorting issue is still there, as far as I know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant