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

fix: Fetch existing messages for bots as InFresh (#4976) #5692

Merged
merged 2 commits into from
Jun 17, 2024

Conversation

iequidoo
Copy link
Collaborator

@iequidoo iequidoo commented Jun 15, 2024

See commit messages.
This should finally fix #4976

After the second commit only webxdc realtime tests are failing.

@iequidoo iequidoo marked this pull request as ready for review June 15, 2024 17:33
@iequidoo iequidoo requested a review from link2xt June 15, 2024 17:33
@iequidoo iequidoo force-pushed the iequidoo/fetch_existing_msgs-bot branch from 4bbe790 to 502cde5 Compare June 16, 2024 19:11
@link2xt
Copy link
Collaborator

link2xt commented Jun 16, 2024

Would be nice to document this behavior in deltachat.h. Probably nobody sets fetch_existing_msgs for bots except for these tests, but it can be unexpected that it works differently for bots and non-bots.

@iequidoo iequidoo force-pushed the iequidoo/fetch_existing_msgs-bot branch from 502cde5 to b89a6fc Compare June 17, 2024 00:24
@@ -696,6 +696,9 @@ async fn add_parts(
prevent_rename: bool,
verified_encryption: VerifiedEncryption,
) -> Result<ReceivedMsg> {
let is_bot = context.get_config_bool(Config::Bot).await?;
// Bots handle existing messages the same way as new ones.
let fetching_existing_messages = fetching_existing_messages && !is_bot;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it's more straigtforward to reset fetch_existing_messages here for bots as it is checked in several places

Before, if `Config::FetchExistingMsgs` is set, existing messages were received with the `InSeen`
state set, but for bots they must be `InFresh` and also `IncomingMsg` events should be emitted for
them so that they are processed by bots as it happens with new messages.
…ts (#4976)

Test bots are run with `fetch_existing_msgs` set, so messages must be deleted immediately not to be
processed again after a bot redeployment.
@iequidoo iequidoo force-pushed the iequidoo/fetch_existing_msgs-bot branch from b89a6fc to 010f2a2 Compare June 17, 2024 00:34
@iequidoo iequidoo merged commit 3b91815 into main Jun 17, 2024
37 checks passed
@iequidoo iequidoo deleted the iequidoo/fetch_existing_msgs-bot branch June 17, 2024 01:16
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.

test_echo_quit_plugin is flaky
2 participants