[GH-ISSUE #1369] Default sort in Junk folder is incorrect (was "Junk folder not updated") #640

Closed
opened 2026-02-25 21:35:34 +03:00 by kerem · 12 comments
Owner

Originally created by @ulfgebhardt on GitHub (Nov 19, 2024).
Original GitHub issue: https://github.com/cypht-org/cypht/issues/1369

Originally assigned to: @mercihabam on GitHub.

🐛 Bugreport

Junk folder not updated

The Junk folder is not refetched when selecting it - I assume this applies to all folders.

My Junk folder is automatically filled by my email server, but when I have fetched the Junk folder once in cypht it is only refreshed when I change the sort order of the folder (and revert that setting).
Logout/Login works aswell.

image

(I do not know if my email server somehow violates some imap requirement/update mechanic - this is a potential external source for this issue)

Version & Environment

Rev: [v2.4.0]

OS: [chromium, alpine]

Steps to reproduce

  1. Open folder
  2. Move mail into folder on mail server
  3. See no change when navigating to the folder again (including f5)
  4. ...
  5. Profit
Originally created by @ulfgebhardt on GitHub (Nov 19, 2024). Original GitHub issue: https://github.com/cypht-org/cypht/issues/1369 Originally assigned to: @mercihabam on GitHub. ## 🐛 Bugreport <!-- Describe your issue in detail. Include screenshots if needed. Give us as much information as possible. --> Junk folder not updated The Junk folder is not refetched when selecting it - I assume this applies to all folders. My Junk folder is automatically filled by my email server, but when I have fetched the Junk folder once in cypht it is only refreshed when I change the sort order of the folder (and revert that setting). Logout/Login works aswell. ![image](https://github.com/user-attachments/assets/a6c36ad1-2cc9-48c4-8af6-bce8a118ab3a) (I do not know if my email server somehow violates some imap requirement/update mechanic - this is a potential external source for this issue) ### Version & Environment <!-- Paste Git-Commit ID or Tag-Name here --> Rev: [v2.4.0] <!-- Specify your OS and OS Version here if the issue is (most likely) platform dependent. --> OS: [chromium, alpine] ### Steps to reproduce 1. Open folder 2. Move mail into folder on mail server 3. See no change when navigating to the folder again (including f5) 4. ... 5. Profit
kerem closed this issue 2026-02-25 21:35:34 +03:00
Author
Owner

@marclaporte commented on GitHub (Nov 19, 2024):

I assume this applies to all folders.

Please try others to confirm. If you toggle between inbox, junk, draft, etc., it should always refresh

What is your mail server? (Dovecot? Cyrus? etc.)

<!-- gh-comment-id:2485632877 --> @marclaporte commented on GitHub (Nov 19, 2024): > I assume this applies to all folders. Please try others to confirm. If you toggle between inbox, junk, draft, etc., it should always refresh What is your mail server? (Dovecot? Cyrus? etc.)
Author
Owner

@marclaporte commented on GitHub (Nov 19, 2024):

This is what you want, right?
https://en.wikipedia.org/wiki/IMAP_IDLE

<!-- gh-comment-id:2485649237 --> @marclaporte commented on GitHub (Nov 19, 2024): This is what you want, right? https://en.wikipedia.org/wiki/IMAP_IDLE
Author
Owner

@ulfgebhardt commented on GitHub (Nov 19, 2024):

This is what you want, right? https://en.wikipedia.org/wiki/IMAP_IDLE

No, I do an user action. I reselect the mailbox or reload the window. This does not refresh the contents tho.
Changing the sort order forces a query to the server and gives updated results

I will try to capture such network traffic and evaluate if the new messages arrive in the client or not.

<!-- gh-comment-id:2486074876 --> @ulfgebhardt commented on GitHub (Nov 19, 2024): > This is what you want, right? https://en.wikipedia.org/wiki/IMAP_IDLE No, I do an user action. I reselect the mailbox or reload the window. This does not refresh the contents tho. Changing the sort order forces a query to the server and gives updated results I will try to capture such network traffic and evaluate if the new messages arrive in the client or not.
Author
Owner

@mercihabam commented on GitHub (Nov 21, 2024):

@ulfgebhardt, the list of messages for your folder updates whenever a user navigates to that specific folder. However, if there is cached data, it is displayed first. As a result, if the cached data matches the server's response, it may appear as though no request was made to the server.

<!-- gh-comment-id:2490222080 --> @mercihabam commented on GitHub (Nov 21, 2024): @ulfgebhardt, the list of messages for your folder updates whenever a user navigates to that specific folder. However, if there is cached data, it is displayed first. As a result, if the cached data matches the server's response, it may appear as though no request was made to the server.
Author
Owner

@ulfgebhardt commented on GitHub (Nov 21, 2024):

Navigating to Junk Folder:
image
Apparently background refresh is happening:
image

Sending myself a Junk Message:
image

Receiving spam on server:
image

No automatic refresh on the page - messages not visible:
image

Navigate to Mailbox & Back to Junk - messages not visible:
image

Changing sort oder twice - reveals messages:
image

Still unclear: Is the folder status not correctly reported by imap (server moves mail via sieve) or is this a caching problem of cypht. Also unclear if the update successfully reaches the client (there is network traffic) or if the updates omit the new message.

I am not subscribed to the folder in question:
image

<!-- gh-comment-id:2490513791 --> @ulfgebhardt commented on GitHub (Nov 21, 2024): Navigating to Junk Folder: ![image](https://github.com/user-attachments/assets/5d0477b2-d8a9-425d-b0c5-5ea0370e7991) Apparently background refresh is happening: ![image](https://github.com/user-attachments/assets/09133264-9fb7-45f9-981c-415098a1f150) Sending myself a Junk Message: ![image](https://github.com/user-attachments/assets/cedc946a-a274-4d12-a42d-7b1819a8c793) Receiving spam on server: ![image](https://github.com/user-attachments/assets/033071fb-910d-46c6-8240-064b2dbda3ef) No automatic refresh on the page - messages not visible: ![image](https://github.com/user-attachments/assets/50dcb7d7-2efa-4c5d-9f24-3e3ac430903c) Navigate to Mailbox & Back to Junk - messages not visible: ![image](https://github.com/user-attachments/assets/23151e3c-ce29-4202-bc42-037f3f8b4062) Changing sort oder twice - reveals messages: ![image](https://github.com/user-attachments/assets/769fc0b4-7ee5-46f5-a8f1-29526fd17260) Still unclear: Is the folder status not correctly reported by imap (server moves mail via sieve) or is this a caching problem of cypht. Also unclear if the update successfully reaches the client (there is network traffic) or if the updates omit the new message. I am not subscribed to the folder in question: ![image](https://github.com/user-attachments/assets/709fcb55-ae02-4c2f-99bc-4a9ef3137c8c)
Author
Owner

@mercihabam commented on GitHub (Nov 21, 2024):

The question relevant to your scenario is: when examining the automatic refresh of network data, does your new message appear along with the other data? If it doesn’t, we might need to investigate the sieve filters.

<!-- gh-comment-id:2491084886 --> @mercihabam commented on GitHub (Nov 21, 2024): The question relevant to your scenario is: when examining the automatic refresh of network data, does your new message appear along with the other data? If it doesn’t, we might need to investigate the sieve filters.
Author
Owner

@mercihabam commented on GitHub (Nov 21, 2024):

Additionally, does the refresh icon in the top bar, located just before the search input, help you see the new message?

<!-- gh-comment-id:2491093431 --> @mercihabam commented on GitHub (Nov 21, 2024): Additionally, does the refresh icon in the top bar, located just before the search input, help you see the new message?
Author
Owner

@ulfgebhardt commented on GitHub (Nov 21, 2024):

Additionally, does the refresh icon in the top bar, located just before the search input, help you see the new message?

This I can answer: no

<!-- gh-comment-id:2492386252 --> @ulfgebhardt commented on GitHub (Nov 21, 2024): > Additionally, does the refresh icon in the top bar, located just before the search input, help you see the new message? This I can answer: no
Author
Owner

@ulfgebhardt commented on GitHub (Nov 21, 2024):

The question relevant to your scenario is: when examining the automatic refresh of network data, does your new message appear along with the other data? If it doesn’t, we might need to investigate the sieve filters.

This i can see in my network travel (another test)

{
    "0": "<tr class=\"imap_6738e4f407104_493_4a756e6b email @XXX unseen\" data-uid=\"493\"><td class=\"checkbox_cell\"><input id=\"imap_6738e4f407104_493_4a756e6b\" type=\"checkbox\" value=\"imap_6738e4f407104_493_4a756e6b\" /><label class=\"checkbox_label\" for=\"imap_6738e4f407104_493_4a756e6b\"></label></td><td class=\"source\" data-title=\"@XXX-Junk\"><i class=\"bi bi-filetype-env_closed\"></i>@XXX-Junk</td><td class=\"from\" data-title=\"  SOURCE-EMAIL-ADDRESS\">Ulf Gebhardt</td><td class=\"subject\"><div class=\"unseen\"><a title=\" test crypht 1234\" href=\"?page=message&amp;uid=493&amp;list_path=imap_6738e4f407104_4a756e6b&amp;list_parent=imap_6738e4f407104_4a756e6b&amp;list_page=1&amp;sort=arrival&amp;filter=all\"> test crypht 1234</a></div></td><td class=\"msg_date\" title=\"Thu, 21 Nov 2024 22:44:56 +0100\">30 seconds<input type=\"hidden\" class=\"msg_timestamp\" value=\"1732225496\" /></td><td class=\"icon\" title=\"\"></td></tr>",
    "1": "imap_6738e4f407104_493_4a756e6b"
}

This is the last element in the list and also the root cause of the problem: The sort order of the mails is incorrect - i can actually see the email, but at the end of the list
image

image
...
image


The problem is not that the message is not displayed - but the new message is wrongly appended onto the end of the list (see screenshot above)

Furthermore - the second last message is displayed as first message.
Hence: (first in network = last in list === last in network = first in list) but when new messages arrive they are appended at the end of the list and not put infront.

<!-- gh-comment-id:2492415446 --> @ulfgebhardt commented on GitHub (Nov 21, 2024): > The question relevant to your scenario is: when examining the automatic refresh of network data, does your new message appear along with the other data? If it doesn’t, we might need to investigate the sieve filters. This i can see in my network travel (another test) ``` { "0": "<tr class=\"imap_6738e4f407104_493_4a756e6b email @XXX unseen\" data-uid=\"493\"><td class=\"checkbox_cell\"><input id=\"imap_6738e4f407104_493_4a756e6b\" type=\"checkbox\" value=\"imap_6738e4f407104_493_4a756e6b\" /><label class=\"checkbox_label\" for=\"imap_6738e4f407104_493_4a756e6b\"></label></td><td class=\"source\" data-title=\"@XXX-Junk\"><i class=\"bi bi-filetype-env_closed\"></i>@XXX-Junk</td><td class=\"from\" data-title=\" SOURCE-EMAIL-ADDRESS\">Ulf Gebhardt</td><td class=\"subject\"><div class=\"unseen\"><a title=\" test crypht 1234\" href=\"?page=message&amp;uid=493&amp;list_path=imap_6738e4f407104_4a756e6b&amp;list_parent=imap_6738e4f407104_4a756e6b&amp;list_page=1&amp;sort=arrival&amp;filter=all\"> test crypht 1234</a></div></td><td class=\"msg_date\" title=\"Thu, 21 Nov 2024 22:44:56 +0100\">30 seconds<input type=\"hidden\" class=\"msg_timestamp\" value=\"1732225496\" /></td><td class=\"icon\" title=\"\"></td></tr>", "1": "imap_6738e4f407104_493_4a756e6b" } ``` This is the last element in the list and also the root cause of the problem: The sort order of the mails is incorrect - i can actually see the email, but at the end of the list ![image](https://github.com/user-attachments/assets/2b3d24c7-f7dd-47ce-bbab-bdcc4d3829ab) ![image](https://github.com/user-attachments/assets/a1c37bc5-4301-406a-b195-8e56b1f69531) ... ![image](https://github.com/user-attachments/assets/24270690-3942-487e-9501-b171b4f64e9c) --- **The problem is not that the message is not displayed - but the new message is wrongly appended onto the end of the list** (see screenshot above) Furthermore - the second last message is displayed as first message. Hence: (first in network = last in list === last in network = first in list) but when new messages arrive they are appended at the end of the list and not put infront.
Author
Owner

@marclaporte commented on GitHub (Nov 22, 2024):

The sort order of the mails is incorrect

Good catch! This should be easy to fix. Some similar issues were addressed via https://github.com/cypht-org/cypht/pull/1345

<!-- gh-comment-id:2492680719 --> @marclaporte commented on GitHub (Nov 22, 2024): > The sort order of the mails is incorrect Good catch! This should be easy to fix. Some similar issues were addressed via https://github.com/cypht-org/cypht/pull/1345
Author
Owner

@mercihabam commented on GitHub (Nov 22, 2024):

The sort order should have already been fixed. Please try with the latest master!

<!-- gh-comment-id:2493247964 --> @mercihabam commented on GitHub (Nov 22, 2024): The sort order should have already been fixed. Please try with the latest master!
Author
Owner

@ulfgebhardt commented on GitHub (Nov 22, 2024):

Will confirm fix with next release - feel free to close this, if you think it has been addressed

<!-- gh-comment-id:2493593076 --> @ulfgebhardt commented on GitHub (Nov 22, 2024): Will confirm fix with next release - feel free to close this, if you think it has been addressed
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cypht#640
No description provided.