-
-
Notifications
You must be signed in to change notification settings - Fork 114
fix: add info message if user tries to create a QR code for deprecated channel #7399
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,9 +4,13 @@ use anyhow::{Context as _, Error, Result, bail, ensure}; | |
| use deltachat_contact_tools::ContactAddress; | ||
| use percent_encoding::{AsciiSet, utf8_percent_encode}; | ||
|
|
||
| use crate::chat::{self, Chat, ChatId, ChatIdBlocked, get_chat_id_by_grpid}; | ||
| use crate::chat::{ | ||
| self, Chat, ChatId, ChatIdBlocked, add_info_msg, get_chat_id_by_grpid, load_broadcast_secret, | ||
| }; | ||
| use crate::config::Config; | ||
| use crate::constants::{Blocked, Chattype, NON_ALPHANUMERIC_WITHOUT_DOT}; | ||
| use crate::constants::{ | ||
| BROADCAST_INCOMPATIBILITY_MSG, Blocked, Chattype, NON_ALPHANUMERIC_WITHOUT_DOT, | ||
| }; | ||
| use crate::contact::mark_contact_id_as_verified; | ||
| use crate::contact::{Contact, ContactId, Origin}; | ||
| use crate::context::Context; | ||
|
|
@@ -98,6 +102,16 @@ pub async fn get_securejoin_qr(context: &Context, chat: Option<ChatId>) -> Resul | |
| error!(context, "get_securejoin_qr: {}.", err); | ||
| bail!(err); | ||
| } | ||
| 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: | ||
| 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?; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, then makes sense to make it an error and also log |
||
| bail!(text.to_string()); | ||
| } | ||
| } | ||
| Some(chat) | ||
| } | ||
| None => None, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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