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

feat: Set BccSelf to true when receiving a sync message #6434

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Hocuri
Copy link
Collaborator

@Hocuri Hocuri commented Jan 13, 2025

Fix #6433

I at first only wanted to do it any outgoing messages, but @link2xt was concerned that this may accidentally enable bcc_self, e.g. if:

  • you send out a message
  • it's deleted, e.g. via ephemeral messages
  • Someone forwards this outgoing message to you again, e.g. via a mailing list.

If more people report the bug, then we should do it for any outgoing messages and/or revert #6344 (except for the migration).

@Hocuri Hocuri requested review from hpk42, link2xt and iequidoo January 13, 2025 16:32
let alice1 = TestContext::new_alice().await;
let alice2 = TestContext::new_alice().await;

alice1.set_config_bool(Config::IsChatmail, true).await?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe also test for non-chatmail, this should work for non-chatmail too.

alice1.set_config_bool(Config::SyncMsgs, true).await?;
alice2.set_config_bool(Config::SyncMsgs, true).await?;

alice1.set_config_bool(Config::BccSelf, true).await?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also check that alice2 has BccSelf disabled. In case of non-chatmail, disable it manually.

Copy link
Collaborator

@iequidoo iequidoo left a comment

Choose a reason for hiding this comment

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

The documentation for SyncMsgs says:

    /// Enable sending and executing (applying) sync messages. Sending requires `BccSelf` to be set                                                                                                                  
    /// and `Bot` unset.

I think it should now reflect that sending sync messages is auto-enabled on receipt of a sync message because BccSelf is auto-enabled. And the documentation for BccSelf as well.


// Since there was a sync message, we know that there is a second device.
// Set BccSelf to true if it isn't already.
if !items.items.is_empty() && !self.get_config_bool(Config::BccSelf).await.unwrap_or(false)
Copy link
Collaborator

Choose a reason for hiding this comment

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

!= Ok(true) is easier to read, but i'd make it == Ok(false), i think we don't want to set the config on failures.

@r10s
Copy link
Member

r10s commented Jan 14, 2025

If more people report the bug, then we should do it for any outgoing messages and/or revert #6344 (except for the migration)

as @iequidoo meanwhile figured out a possible concrete reason for the bug and did an on-point-fix at #6437 - wondering if this mitigation-PR then still makes sense, knowing it contains network thingies and may result in other bugs :) i am +/-0 here, i just want to raise the question :)

@iequidoo
Copy link
Collaborator

wondering if this mitigation-PR then still makes sense, knowing it contains network thingies and may result in other bugs :)

I tried to remember why currently we apply sync messages if SyncMsgs is enabled, but also require BccSelf to send them, but i couldn't. To make "master->slave" synchronization possible? Not sure if this is really needed, so i'm fine with merging this.

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.

Enable bcc_self=1 every time we detect a sync message in our inbox
4 participants