Skip to content

Conversation

@Hocuri
Copy link
Collaborator

@Hocuri Hocuri commented Nov 4, 2025

Fix #7397:

  • If adding a member to a channel fails, add an info message with the error rather than landing in an infinite imap loop
  • Don't allow even creating a QR code for such old channels.

I think about how we could add tests yet, and I didn't think yet about whether this is the best solution.

true,
)
.await;
if let Err(e) = res {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This part can now be reverted, solution for dealing with exceptional receive_imf errors is at #7401

Copy link
Collaborator

Choose a reason for hiding this comment

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

True, it'd good to have more informative messages like this (and in the corresponding chats, not in the device chat), but we can't add such a code for all failing paths

@Hocuri Hocuri force-pushed the hoc/fix-broadcast-infinite-loop branch from 9e5f21a to ebd4da5 Compare November 5, 2025 10:00
if chat.typ == Chattype::OutBroadcast {
// If the user created the broadcast before updating Delta Chat,
// then the secret will be missing, and the user needs to recreate the broadcast:
// let secret = load_broadcast_secret(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.

Is this commented out code somehow related to the comment above?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, it was an old version of the code, forgot to remove

@link2xt
Copy link
Collaborator

link2xt commented Nov 5, 2025

Infinite loop is already fixed on main, so this change is something else, more like "add info message if user tries to create a QR code for deprecated channel"

@Hocuri Hocuri changed the title fix: Fix broadcast infinite loop fix: add info message if user tries to create a QR code for deprecated channel Nov 5, 2025
Hocuri added a commit to deltachat/deltachat-android that referenced this pull request Nov 5, 2025
Before this PR, when a QR code couldn't be loaded because of
chatmail/core#7399, Delta Chat crashed.

Now, the button does nothing.
if load_broadcast_secret(context, chat.id).await?.is_none() {
warn!(context, "Not creating securejoin QR for old broadcast");
let text = BROADCAST_INCOMPATIBILITY_MSG;
add_info_msg(context, chat.id, text, time()).await?;
Copy link
Collaborator

@iequidoo iequidoo Nov 5, 2025

Choose a reason for hiding this comment

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

Why showing an error toast isn't enough? Because the message is large? The info message will persist, this doesn't look useful

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes.

The info message is supposed to persist forever; this broadcast channel can't be used anymore and has to be recreated, because the secret is missing.

Copy link
Collaborator

Choose a reason for hiding this comment

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

warn! could still be replaced with an error! so there is some short toast in addition to info message, but the info message is for having a guide on how to migrate.

Copy link
Collaborator

@iequidoo iequidoo Nov 5, 2025

Choose a reason for hiding this comment

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

Ok, then makes sense to make it an error and also log chat.id

// If the user created the broadcast before updating Delta Chat,
// then the secret will be missing, and the user needs to recreate the broadcast:
if load_broadcast_secret(context, chat.id).await?.is_none() {
warn!(context, "Not creating securejoin QR for old broadcast");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
warn!(context, "Not creating securejoin QR for old broadcast");
warn!(context, "Not creating securejoin QR for old broadcast {}.", chat.id);

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 saw this too late

@Hocuri Hocuri merged commit a40fd28 into main Nov 5, 2025
51 of 54 checks passed
@Hocuri Hocuri deleted the hoc/fix-broadcast-infinite-loop branch November 5, 2025 16:16
Hocuri added a commit to deltachat/deltachat-android that referenced this pull request Nov 5, 2025
Before this PR, when a QR code couldn't be loaded because of chatmail/core#7399, Delta Chat crashed.

Now, the button does nothing.

It's not perfect, but easy to do, and only about an edge case where the user tried out the experimental broadcast channels in the past, and now tries to add a new member to a broadcast channel created with an old version of DC.

The hollistic alternative would be to switch to RPC for getSecurejoinQrSvg, so that the UI can get a proper error message.

---------

Co-authored-by: adb <adb@merlinux.eu>
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.

core 2.24.0 got stuck in imap loop

5 participants