Skip to content

Conversation

@Simon-Laux
Copy link
Contributor

@Simon-Laux Simon-Laux commented Jan 11, 2026

made for solving
deltachat/deltachat-desktop#5891 (comment)

will also be more efficient, because desktop currently loads all fresh messages to find out which chats to mark as noticed. https://github.com/deltachat/deltachat-desktop/blob/76d32bfc9364d53e1ffea40fcf4a60ad9a8482ee/packages/frontend/src/components/AccountListSidebar/AccountItem.tsx#L334

progress

@Simon-Laux Simon-Laux requested a review from WofWca January 11, 2026 06:57
Simon-Laux added a commit to deltachat/deltachat-desktop that referenced this pull request Jan 11, 2026
Simon-Laux added a commit to deltachat/deltachat-desktop that referenced this pull request Jan 11, 2026
Copy link
Collaborator

@WofWca WofWca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sensible overall, didn't test.

Simon-Laux added a commit to deltachat/deltachat-desktop that referenced this pull request Jan 11, 2026
@Simon-Laux Simon-Laux marked this pull request as ready for review January 12, 2026 12:50
@Simon-Laux Simon-Laux requested review from Hocuri and iequidoo January 12, 2026 12:51
Simon-Laux and others added 2 commits January 12, 2026 12:51
Co-authored-by: WofWca <wofwca@protonmail.com>
.await?;

for chat_id in list {
marknoticed_chat(context, chat_id).await?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider skipping messages arrived several seconds before, otherwise the user who wants to mark old messages as noticed may miss new messages, i.e. it's a user-app interaction race condition. Need to pass some flag to marknoticed_chat() for this

Copy link
Contributor Author

@Simon-Laux Simon-Laux Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a dedicated issue, it is already a problem / point for discussion. (problem not newly introduced by this pr)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this new feature it's worse because the probability of receiving a new message in any chat while interacting with the UI is much bigger than one for a particular chat. But as it's not a regression, i agree that it can be solved later

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not a new feature, I'm just moving it to core. Desktop already has the same problem in its current implementation.
Anyway I'll make an issue or a PR for this later and will then mark this thread as resolved.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, it's called "Mark all as read", but in fact it marks all messages as noticed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually, a user who marks a whole account as noticed doesn't care that much about the unseen messages. Otherwise, they would open the account, and look into all the chats. So, that's not a concern.

Copy link
Contributor Author

@Simon-Laux Simon-Laux Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually, a user who marks a whole account as noticed doesn't care that much about the unseen messages.

The timeout is about an edge case.
Another use case for the "mark all as read" feature is that you have an unread badge and the account open, but you can't easily find the chat with the unread message and just want to get rid of the badge.

Though you could still argue that the chat with the unread badge will probably be shown prominently enough at the top (unless it was archived).

So should we just ignore this for now in the name of saving work?
Disadvantage is that this kind of issue is not very likely to be reported because it will be rare, but it is about the user missing potentially important messages, so could be quite annoying for people who run into the issue.

.await?;

for chat_id in list {
marknoticed_chat(context, chat_id).await?;
Copy link
Collaborator

@Hocuri Hocuri Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't use marknoticed_chat(). E.g. marknoticed_chat() calls start_chat_ephemeral_timers(context, chat_id).await?;.

This function could probably just do this?

        let noticed_msgs_count = context
            .sql
            .execute(
                "UPDATE msgs
            SET state=?
          WHERE state=?
            AND hidden=0",
                (MessageState::InNoticed, MessageState::InFresh),
            )
            .await?;

        if noticed_msgs_count > 0 {
            // emit events
        }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should it not all the ephemeral timers? Wouldn't it be a potential security/confidentiality issue if it would not call it, why does marknoticed_chat call the ephemeral timers?

.await?;

for chat_id in list {
marknoticed_chat(context, chat_id).await?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually, a user who marks a whole account as noticed doesn't care that much about the unseen messages. Otherwise, they would open the account, and look into all the chats. So, that's not a concern.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants