-
-
Notifications
You must be signed in to change notification settings - Fork 99
Remove "Accepted contacts" option for downloading emails #6807
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
Draft
link2xt
wants to merge
3
commits into
main
Choose a base branch
from
link2xt/contact-origin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -226,7 +226,6 @@ class ShowEmails(IntEnum): | |
"""Show emails mode""" | ||
|
||
OFF = 0 | ||
ACCEPTED_CONTACTS = 1 | ||
ALL = 2 | ||
|
||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -322,7 +322,7 @@ pub(crate) async fn receive_imf_inner( | |
// For example, GitHub sends messages from `[email protected]`, | ||
// but uses display name of the user whose action generated the notification | ||
// as the display name. | ||
let (from_id, _from_id_blocked, incoming_origin) = | ||
let (from_id, _from_id_blocked) = | ||
match from_field_to_contact_id(context, &mime_parser.from, prevent_rename).await? { | ||
Some(contact_id_res) => contact_id_res, | ||
None => { | ||
|
@@ -337,27 +337,16 @@ pub(crate) async fn receive_imf_inner( | |
let to_ids = add_or_lookup_contacts_by_address_list( | ||
context, | ||
&mime_parser.recipients, | ||
if !mime_parser.incoming { | ||
Origin::OutgoingTo | ||
} else if incoming_origin.is_known() { | ||
Origin::IncomingTo | ||
} else { | ||
if mime_parser.incoming { | ||
Origin::IncomingUnknownTo | ||
}, | ||
) | ||
.await?; | ||
let past_ids = add_or_lookup_contacts_by_address_list( | ||
context, | ||
&mime_parser.past_members, | ||
if !mime_parser.incoming { | ||
Origin::OutgoingTo | ||
} else if incoming_origin.is_known() { | ||
Origin::IncomingTo | ||
} else { | ||
Origin::IncomingUnknownTo | ||
Origin::OutgoingTo | ||
}, | ||
) | ||
.await?; | ||
let past_ids = | ||
add_or_lookup_contacts_by_address_list(context, &mime_parser.past_members, Origin::Hidden) | ||
.await?; | ||
|
||
update_verified_keys(context, &mut mime_parser, from_id).await?; | ||
|
||
|
@@ -655,7 +644,7 @@ pub(crate) async fn receive_imf_inner( | |
|
||
/// Converts "From" field to contact id. | ||
/// | ||
/// Also returns whether it is blocked or not and its origin. | ||
/// Also returns whether it is blocked or not. | ||
/// | ||
/// * `prevent_rename`: if true, the display_name of this contact will not be changed. Useful for | ||
/// mailing lists: In some mailing lists, many users write from the same address but with different | ||
|
@@ -667,7 +656,7 @@ pub async fn from_field_to_contact_id( | |
context: &Context, | ||
from: &SingleInfo, | ||
prevent_rename: bool, | ||
) -> Result<Option<(ContactId, bool, Origin)>> { | ||
) -> Result<Option<(ContactId, bool)>> { | ||
let display_name = if prevent_rename { | ||
Some("") | ||
} else { | ||
|
@@ -693,12 +682,11 @@ pub async fn from_field_to_contact_id( | |
.await?; | ||
|
||
if from_id == ContactId::SELF { | ||
Ok(Some((ContactId::SELF, false, Origin::OutgoingBcc))) | ||
Ok(Some((ContactId::SELF, false))) | ||
} else { | ||
let contact = Contact::get_by_id(context, from_id).await?; | ||
let from_id_blocked = contact.blocked; | ||
let incoming_origin = contact.origin; | ||
Ok(Some((from_id, from_id_blocked, incoming_origin))) | ||
Ok(Some((from_id, from_id_blocked))) | ||
} | ||
} | ||
|
||
|
@@ -773,8 +761,7 @@ async fn add_parts( | |
chat_id = Some(DC_CHAT_ID_TRASH); | ||
allow_creation = false; | ||
} | ||
ShowEmails::AcceptedContacts => allow_creation = false, | ||
ShowEmails::All => allow_creation = !is_mdn, | ||
ShowEmails::All | ShowEmails::All1 => allow_creation = !is_mdn, | ||
} | ||
} else { | ||
allow_creation = !is_mdn && !is_reaction; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,11 +113,8 @@ async fn test_adhoc_group_outgoing_show_accepted_contact_unaccepted() -> Result< | |
let mut tcm = TestContextManager::new(); | ||
let alice = &tcm.alice().await; | ||
let bob = &tcm.bob().await; | ||
bob.set_config( | ||
Config::ShowEmails, | ||
Some(&ShowEmails::AcceptedContacts.to_string()), | ||
) | ||
.await?; | ||
bob.set_config(Config::ShowEmails, Some(&ShowEmails::All.to_string())) | ||
.await?; | ||
tcm.send_recv(alice, bob, "hi").await; | ||
receive_imf( | ||
bob, | ||
|
@@ -140,7 +137,7 @@ async fn test_adhoc_group_outgoing_show_accepted_contact_unaccepted() -> Result< | |
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] | ||
async fn test_adhoc_group_show_accepted_contact_known() { | ||
let t = TestContext::new_alice().await; | ||
t.set_config(Config::ShowEmails, Some("1")).await.unwrap(); | ||
t.set_config(Config::ShowEmails, Some("2")).await.unwrap(); | ||
Contact::create(&t, "Bob", "[email protected]").await.unwrap(); | ||
receive_imf(&t, GRP_MAIL, false).await.unwrap(); | ||
|
||
|
@@ -153,7 +150,7 @@ async fn test_adhoc_group_show_accepted_contact_known() { | |
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] | ||
async fn test_adhoc_group_show_accepted_contact_accepted() { | ||
let t = TestContext::new_alice().await; | ||
t.set_config(Config::ShowEmails, Some("1")).await.unwrap(); | ||
t.set_config(Config::ShowEmails, Some("2")).await.unwrap(); | ||
|
||
// accept Bob by accepting a delta-message from Bob | ||
receive_imf(&t, MSGRMSG, false).await.unwrap(); | ||
|
@@ -2322,7 +2319,7 @@ async fn test_ignore_footer_status_from_mailinglist() -> Result<()> { | |
&t, | ||
"", | ||
&ContactAddress::new("[email protected]").unwrap(), | ||
Origin::IncomingUnknownCc, | ||
Origin::IncomingUnknownTo, | ||
) | ||
.await? | ||
.0; | ||
|
@@ -3988,7 +3985,7 @@ async fn test_mua_user_adds_recipient_to_single_chat() -> Result<()> { | |
chat::get_chat_contacts(&alice, group_chat.id).await?.len(), | ||
4 | ||
); | ||
let fiona = Contact::lookup_id_by_addr(&alice, "[email protected]", Origin::IncomingTo) | ||
let fiona = Contact::lookup_id_by_addr(&alice, "[email protected]", Origin::IncomingUnknownTo) | ||
.await? | ||
.unwrap(); | ||
assert!(chat::is_contact_in_chat(&alice, group_chat.id, fiona).await?); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 was the case before this PR already, but, for my understanding: The order here determines which authnames are used, i.e. "better" origins overwrite the names of "worse" origins, with an exception that IncomingUnknownFrom may overwrite any other authname. (The origin also determines that contacts with at least IncomingReplyTo origin are shown in the contact list.)
I find the order super weird:
Is there something I'm missing?
In any case, I'm not saying we have to change this now, can come after multi-transport.