mirror of
https://github.com/chatmail/core.git
synced 2026-05-13 11:56:30 +03:00
refactor: receive_imf::add_parts: Remove excessive from_id == ContactId::SELF checks
`mime_parser.incoming` is already here for this and is checked above.
This commit is contained in:
@@ -930,15 +930,11 @@ async fn add_parts(
|
|||||||
|
|
||||||
if chat_id.is_none() {
|
if chat_id.is_none() {
|
||||||
// try to create a normal chat
|
// try to create a normal chat
|
||||||
let create_blocked = if from_id == ContactId::SELF {
|
let contact = Contact::get_by_id(context, from_id).await?;
|
||||||
Blocked::Not
|
let create_blocked = match contact.is_blocked() {
|
||||||
} else {
|
true => Blocked::Yes,
|
||||||
let contact = Contact::get_by_id(context, from_id).await?;
|
false if is_bot => Blocked::Not,
|
||||||
match contact.is_blocked() {
|
false => Blocked::Request,
|
||||||
true => Blocked::Yes,
|
|
||||||
false if is_bot => Blocked::Not,
|
|
||||||
false => Blocked::Request,
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(chat) = test_normal_chat {
|
if let Some(chat) = test_normal_chat {
|
||||||
@@ -1032,8 +1028,7 @@ async fn add_parts(
|
|||||||
state = MessageState::OutDelivered;
|
state = MessageState::OutDelivered;
|
||||||
to_id = to_ids.first().copied().unwrap_or_default();
|
to_id = to_ids.first().copied().unwrap_or_default();
|
||||||
|
|
||||||
let self_sent =
|
let self_sent = to_ids.len() == 1 && to_ids.contains(&ContactId::SELF);
|
||||||
from_id == ContactId::SELF && to_ids.len() == 1 && to_ids.contains(&ContactId::SELF);
|
|
||||||
|
|
||||||
if mime_parser.sync_items.is_some() && self_sent {
|
if mime_parser.sync_items.is_some() && self_sent {
|
||||||
chat_id = Some(DC_CHAT_ID_TRASH);
|
chat_id = Some(DC_CHAT_ID_TRASH);
|
||||||
|
|||||||
Reference in New Issue
Block a user