-
-
Notifications
You must be signed in to change notification settings - Fork 137
fix: recognize self addresses in various places (instead of just the "primary") #8533
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
48df2e7
55d30b1
7869b09
6ed7434
b5b5799
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 |
|---|---|---|
|
|
@@ -1230,17 +1230,13 @@ ORDER BY c.origin>=? DESC, c.last_seen DESC, c.id DESC | |
| .await?; | ||
|
|
||
| if let Some(query) = query { | ||
| let self_addr = context | ||
| .get_config(Config::ConfiguredAddr) | ||
| .await? | ||
| .unwrap_or_default(); | ||
| let self_name = context | ||
| .get_config(Config::Displayname) | ||
| .await? | ||
| .unwrap_or_default(); | ||
| let self_name2 = stock_str::self_msg(context); | ||
|
|
||
| if self_addr.contains(query) | ||
| if self_addrs.iter().any(|a| a.contains(query)) | ||
|
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. This change and the test in |
||
| || self_name.contains(query) | ||
| || self_name2.contains(query) | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3177,15 +3177,13 @@ async fn apply_group_changes( | |
| .await?; | ||
| } else { | ||
| let mut new_members: BTreeSet<ContactId>; | ||
| // True if a Delta Chat client has explicitly and really added our primary address to an | ||
|
Comment on lines
3178
to
-3180
Contributor
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. this code block is untested, and writing a test seems involved (i tried). |
||
| // already existing group. | ||
| let self_added = | ||
| if let Some(added_addr) = mime_parser.get_header(HeaderDef::ChatGroupMemberAdded) { | ||
| addr_cmp(&context.get_primary_self_addr().await?, added_addr) | ||
| && !chat_contacts.contains(&ContactId::SELF) | ||
| } else { | ||
| false | ||
| }; | ||
| let self_added = if let Some(added_addr) = | ||
| mime_parser.get_header(HeaderDef::ChatGroupMemberAdded) | ||
| { | ||
| context.is_self_addr(added_addr).await? && !chat_contacts.contains(&ContactId::SELF) | ||
| } else { | ||
| false | ||
| }; | ||
| if self_added { | ||
| new_members = BTreeSet::from_iter(to_ids_flat.iter().copied()); | ||
| new_members.insert(ContactId::SELF); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
This looks like the self recipient may be added twice now under some circumstances?
I just noticed that we don't have any tests at all for recipients, will write oneEdit: Nevermind, we do have some tests for it
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.
What we did not have is a test for not adding the self address twice in a group, or for not adding it at all when bcc_self is off. I wrote a test, and directly pushed it since @hpk42 said he won't engage much with DC development this week
Uh oh!
There was an error while loading. Please reload this page.
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.
The self recipient may now be added twice if one of the group members' transports uses the same address as the self (primary) self address. This is such a rare case (and an already-broken setup) that it seems fine. For all other cases, the
if id != ContactId::SELFchecks inmimefactory.rsare most likely enough (confirmed by the test I just added).