[GH-ISSUE #1478] 🐛 [Bug] Message list in combined view is not showing expected messages #662

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

Originally created by @indridieinarsson on GitHub (Mar 23, 2025).
Original GitHub issue: https://github.com/cypht-org/cypht/issues/1478

Originally assigned to: @mercihabam on GitHub.

🐛 Bug

The messages shown in the Everything view are not the correct ones. This applies at least for when using the "child processes" option.

I have several mail addresses, some with lots of traffic, some with less. When showing the first page of the "Everything" view, I would expect the messages to appear in chronological order, regardless of which server/mailbox they belong to.

That is not the case. Instead, it shows a few messages from each mailbox. The ones from my main address are all from today, but the mails from the less used addresses are from up to 6 days ago.

I did some research, and found the flattenMessagesLists function to be the culprit. It is called from the Hm_Handler_imap_combined_inbox handler, with $maxPerSource set to a fixed value of $maxPerSource = round($limit / count($data_sources));

I think this is wrong, as we cannot know how many messages to take from each source before we have looked at the dates of the messages from each source.

Perhaps it would be better to fetch all the messages from the timespan selected for the combined view, sort all of them by date and serve up the appropriate part of the list, based on the listPage or offset parameters?

Page 1 of my everything stream:
Image

Page 4 of my everything stream. Notice how all the messages are more recent than the oldest messages on the first page.
Image

Version & Environment

Rev: 16b994a3ee

OS: linux/docker

Originally created by @indridieinarsson on GitHub (Mar 23, 2025). Original GitHub issue: https://github.com/cypht-org/cypht/issues/1478 Originally assigned to: @mercihabam on GitHub. ## 🐛 Bug The messages shown in the Everything view are not the correct ones. This applies at least for when using the "child processes" option. I have several mail addresses, some with lots of traffic, some with less. When showing the first page of the "Everything" view, I would expect the messages to appear in chronological order, regardless of which server/mailbox they belong to. That is not the case. Instead, it shows a few messages from each mailbox. The ones from my main address are all from today, but the mails from the less used addresses are from up to 6 days ago. I did some research, and found the `flattenMessagesLists` function to be the culprit. It is called from the `Hm_Handler_imap_combined_inbox` handler, with `$maxPerSource` set to a fixed value of ` $maxPerSource = round($limit / count($data_sources));` I think this is wrong, as we cannot know how many messages to take from each source before we have looked at the dates of the messages from each source. Perhaps it would be better to fetch all the messages from the timespan selected for the combined view, sort all of them by date and serve up the appropriate part of the list, based on the listPage or offset parameters? Page 1 of my everything stream: ![Image](https://github.com/user-attachments/assets/7b0d2830-184e-4244-ba10-33dd0ef50a79) Page **4** of my everything stream. Notice how all the messages are more recent than the oldest messages on the first page. ![Image](https://github.com/user-attachments/assets/9c3dac25-d206-4a18-8af4-389a9f209e21) ### Version & Environment <!-- Paste Git-Commit ID or Tag-Name here --> Rev: 16b994a3ee2336881ef5875b70b1b1b827b2f2db <!-- Specify your OS and OS Version here if the issue is (most likely) platform dependent. --> OS: linux/docker
kerem 2026-02-25 21:35:37 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@marclaporte commented on GitHub (Mar 23, 2025):

@mercihabam any thoughts?

<!-- gh-comment-id:2746513678 --> @marclaporte commented on GitHub (Mar 23, 2025): @mercihabam any thoughts?
Author
Owner

@mercihabam commented on GitHub (Mar 24, 2025):

That was intentional to allow users to see the list of messages both chronologically and in parallel. Ordering the list solely by date isn’t sufficient, as it could result in content from one mailbox dominating the view if it is significantly ahead of the others.

The current algorithm calculates the average number of messages per mailbox and distributes them evenly across pages. If a mailbox contains fewer messages than the average, additional content from a larger mailbox is displayed to balance the page.

<!-- gh-comment-id:2747383555 --> @mercihabam commented on GitHub (Mar 24, 2025): That was intentional to allow users to see the list of messages both chronologically and in parallel. Ordering the list solely by date isn’t sufficient, as it could result in content from one mailbox dominating the view if it is significantly ahead of the others. The current algorithm calculates the average number of messages per mailbox and distributes them evenly across pages. If a mailbox contains fewer messages than the average, additional content from a larger mailbox is displayed to balance the page.
Author
Owner

@indridieinarsson commented on GitHub (Mar 24, 2025):

In my opinion, this could lead to confusion. A user with a use case similar to mine might have to page to the last page to see messages from today.

Let's say a user is confronted with the Everything page, on the first page, and sees a list of messages in chronological order, newest first, oldest at the bottom. I think it is plausible, or even likely, that this user expects the next page in the list to continue the chronological order of the first page, rather than starting with messages that are only slightly older than the newest one on the first page. I know I did, at least.

How was the behaviour in the old implementation, before paging was implemented?

<!-- gh-comment-id:2747935749 --> @indridieinarsson commented on GitHub (Mar 24, 2025): In my opinion, this could lead to confusion. A user with a use case similar to mine might have to page to the last page to see messages from today. Let's say a user is confronted with the Everything page, on the first page, and sees a list of messages in chronological order, newest first, oldest at the bottom. I think it is plausible, or even likely, that this user expects the next page in the list to continue the chronological order of the first page, rather than starting with messages that are only slightly older than the newest one on the first page. I know I did, at least. How was the behaviour in the old implementation, before paging was implemented?
Author
Owner

@mercihabam commented on GitHub (Mar 24, 2025):

In my opinion, this could lead to confusion. A user with a use case similar to mine might have to page to the last page to see messages from today.

Not really what could happen, but I understand the behavior you're suggesting, and I'm fine with either option. If anyone else votes for your suggestion, we'll go for it.

<!-- gh-comment-id:2747982718 --> @mercihabam commented on GitHub (Mar 24, 2025): > In my opinion, this could lead to confusion. A user with a use case similar to mine might have to page to the last page to see messages from today. Not really what could happen, but I understand the behavior you're suggesting, and I'm fine with either option. If anyone else votes for your suggestion, we'll go for it.
Author
Owner

@indridieinarsson commented on GitHub (Mar 24, 2025):

I just uploaded screenshots of my everything page in description of this issue.

On page 4, all the messages are more recent than the last message on page 1.

It may sound as a peculiar use case. But for me, I have one main address, where almost all the traffic is. Then a couple of other addresses where much less mail arrives. For me, monitoring all in one mailbox is the feature in Cypht, and what sets it apart from others webmail solutions.

<!-- gh-comment-id:2748044517 --> @indridieinarsson commented on GitHub (Mar 24, 2025): I just uploaded screenshots of my everything page in description of this issue. On page 4, all the messages are more recent than the last message on page 1. It may sound as a peculiar use case. But for me, I have one main address, where almost all the traffic is. Then a couple of other addresses where much less mail arrives. For me, monitoring all in one mailbox is **the** feature in Cypht, and what sets it apart from others webmail solutions.
Author
Owner

@marclaporte commented on GitHub (Mar 24, 2025):

I just uploaded screenshots of my everything page in description of this issue.

I don't see it.

<!-- gh-comment-id:2748648688 --> @marclaporte commented on GitHub (Mar 24, 2025): > I just uploaded screenshots of my everything page in description of this issue. I don't see it.
Author
Owner

@indridieinarsson commented on GitHub (Mar 24, 2025):

I just uploaded screenshots of my everything page in description of this issue.

I don't see it.

whoopsie, forgot to save. Here now (in description).

<!-- gh-comment-id:2748754339 --> @indridieinarsson commented on GitHub (Mar 24, 2025): > > I just uploaded screenshots of my everything page in description of this issue. > > I don't see it. whoopsie, forgot to save. Here now (in description).
Author
Owner

@indridieinarsson commented on GitHub (Mar 26, 2025):

One more thing. I tried adding in a couple of RSS feeds. Those are shown on the Everything page, but most entries are twice, and they are not sorted among the other messages. Instead, they all appear at the bottom of the page. If I page to page 2 and back to page 1, then each RSS "message" is shown twice, and the feed name (first column) is wrong.

Image

<!-- gh-comment-id:2753953929 --> @indridieinarsson commented on GitHub (Mar 26, 2025): One more thing. I tried adding in a couple of RSS feeds. Those are shown on the Everything page, but most entries are twice, and they are not sorted among the other messages. Instead, they all appear at the bottom of the page. If I page to page 2 and back to page 1, then each RSS "message" is shown twice, and the feed name (first column) is wrong. ![Image](https://github.com/user-attachments/assets/e48151b8-2225-4e33-a9f8-721ac4710f91)
Author
Owner

@marclaporte commented on GitHub (Aug 27, 2025):

When showing the first page of the "Everything" view, I would expect the messages to appear in chronological order, regardless of which server/mailbox they belong to.

This is also the behavior I expect and is how it works in Cypht 1.4.x (which I still use until 2.5.x is released)

Using GitHub's milestone tool, I tagged this issue as a blocker for 2.5.0: https://github.com/cypht-org/cypht/issues/1624

@indridieinarsson There has been a massive amount of work in the last few months: https://github.com/cypht-org/cypht/commits/master/
Would it be possible for you to help us find issues like this in our test environment? (Making it much easier for devs to fix). We are also doing this related to a pagination issue: https://github.com/cypht-org/cypht/issues/1540

Thanks!

<!-- gh-comment-id:3227800976 --> @marclaporte commented on GitHub (Aug 27, 2025): > When showing the first page of the "Everything" view, I would expect the messages to appear in chronological order, regardless of which server/mailbox they belong to. This is also the behavior I expect and is how it works in Cypht 1.4.x (which I still use until 2.5.x is released) Using GitHub's milestone tool, I tagged this issue as a blocker for 2.5.0: https://github.com/cypht-org/cypht/issues/1624 @indridieinarsson There has been a massive amount of work in the last few months: https://github.com/cypht-org/cypht/commits/master/ Would it be possible for you to help us find issues like this in our test environment? (Making it much easier for devs to fix). We are also doing this related to a pagination issue: https://github.com/cypht-org/cypht/issues/1540 Thanks!
Author
Owner

@indridieinarsson commented on GitHub (Aug 27, 2025):

@marclaporte
Yes, I have noticed the massive amount of work being done. I've been following from the sidelines, since I have been very busy with a "home improvement" project gobbling up all of my free time the past months.
The issue described here seems to be mostly solved, but I found one way to mess up the ordering of messages in the combined view (running master, commit 044c381cb5). To reproduce :

  • Take a combined mailbox. I have 3 different mail accounts, combined view shows 7 last days, but at most 20 per source. Busy mailboxes, so the combined view contains less than 7 days worth of messages some sources.
  • Then select a few messages somewhere from the middle of the list and delete them.
  • At first, the list of messages is updated so that the deleted messages disappear. The list now has fewer messages than at the beginning
  • After a while, the list refreshes with additional messages, since there were some messages from my main email account that were not shown previously (younger than 7 days, but below nr 20 in the single-mailbox-list previously).
  • Notice that the newly arrived messages are sorted at the end of the list, regardless of their age. In some cases, this would be correct, since the newly arrived messages would be the oldest from their mailbox, and if you have only one mailbox they would belong at the bottom of the "combined list" anyway. But if you have several sources, the newly arrived messages are not necessarily the oldest in the combined list, only in the list of their originating mailbox.

The list then gets sorted correctly when you refresh the page.

<!-- gh-comment-id:3228080900 --> @indridieinarsson commented on GitHub (Aug 27, 2025): @marclaporte Yes, I have noticed the massive amount of work being done. I've been following from the sidelines, since I have been very busy with a "home improvement" project gobbling up all of my free time the past months. The issue described here seems to be mostly solved, but I found one way to mess up the ordering of messages in the combined view (running master, commit 044c381cb5f2d). To reproduce : - Take a combined mailbox. I have 3 different mail accounts, combined view shows 7 last days, but at most 20 per source. Busy mailboxes, so the combined view contains less than 7 days worth of messages some sources. - Then select a few messages somewhere from the middle of the list and delete them. - At first, the list of messages is updated so that the deleted messages disappear. The list now has fewer messages than at the beginning - After a while, the list refreshes with additional messages, since there were some messages from my main email account that were not shown previously (younger than 7 days, but below nr 20 in the single-mailbox-list previously). - **Notice** that the newly arrived messages are sorted at the end of the list, regardless of their age. In some cases, this would be correct, since the newly arrived messages would be the oldest from their mailbox, and if you have only one mailbox they would belong at the bottom of the "combined list" anyway. But if you have several sources, the newly arrived messages are not necessarily the oldest in the combined list, only in the list of their originating mailbox. The list then gets sorted correctly when you refresh the page.
Author
Owner

@indridieinarsson commented on GitHub (Aug 27, 2025):

@marclaporte
Question : the behavior as I describe in last comment, is really a different one from the one described in the beginning of this issue. One might argue, this since the ordering is correct in the beginning, and becomes correct again upon refreshing, the issue is not a release-blocking one.
Should I close this issue as fixed (as the behaviour described in the original bug report is truly fixed) and make another one with the current behaviour?

<!-- gh-comment-id:3228558494 --> @indridieinarsson commented on GitHub (Aug 27, 2025): @marclaporte Question : the behavior as I describe in last comment, is really a different one from the one described in the beginning of this issue. One might argue, this since the ordering is correct in the beginning, and becomes correct again upon refreshing, the issue is not a release-blocking one. Should I close this issue as fixed (as the behaviour described in the original bug report is truly fixed) and make another one with the current behaviour?
Author
Owner

@marclaporte commented on GitHub (Aug 27, 2025):

It's OK. Let's repurpose this issue for this last issue. I also noticed that "newly arrived messages are sorted at the end of the list, regardless of their age." Indeed not a blocker to the release, but let's try to solve.

@mercihabam Can you please try to reproduce?

<!-- gh-comment-id:3229834255 --> @marclaporte commented on GitHub (Aug 27, 2025): It's OK. Let's repurpose this issue for this last issue. I also noticed that "newly arrived messages are sorted at the end of the list, regardless of their age." Indeed not a blocker to the release, but let's try to solve. @mercihabam Can you please try to reproduce?
Author
Owner

@mercihabam commented on GitHub (Aug 29, 2025):

Sure, I'll give it a try ASAP. Thanks!

<!-- gh-comment-id:3236448546 --> @mercihabam commented on GitHub (Aug 29, 2025): Sure, I'll give it a try ASAP. Thanks!
Author
Owner

@mercihabam commented on GitHub (Aug 30, 2025):

Reproduced and fixed: https://github.com/cypht-org/cypht/pull/1649

<!-- gh-comment-id:3239299819 --> @mercihabam commented on GitHub (Aug 30, 2025): Reproduced and fixed: https://github.com/cypht-org/cypht/pull/1649
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#662
No description provided.