mirror of
https://github.com/chatmail/core.git
synced 2026-05-19 23:06:32 +03:00
less duplicate code on calling inner_set_protection()
This commit is contained in:
@@ -715,25 +715,15 @@ async fn add_parts(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// change chat protection
|
// change chat protection
|
||||||
if mime_parser.is_system_message == SystemMessage::ChatProtectionEnabled {
|
if let Some(new_status) = match mime_parser.is_system_message {
|
||||||
chat_id
|
SystemMessage::ChatProtectionEnabled => Some(ProtectionStatus::Protected),
|
||||||
.inner_set_protection(context, ProtectionStatus::Protected)
|
SystemMessage::ChatProtectionDisabled => Some(ProtectionStatus::Unprotected),
|
||||||
.await?;
|
_ => None,
|
||||||
|
} {
|
||||||
|
chat_id.inner_set_protection(context, new_status).await?;
|
||||||
set_better_msg(
|
set_better_msg(
|
||||||
mime_parser,
|
mime_parser,
|
||||||
context
|
context.stock_protection_msg(new_status, from_id).await,
|
||||||
.stock_protection_msg(ProtectionStatus::Protected, from_id)
|
|
||||||
.await,
|
|
||||||
);
|
|
||||||
} else if mime_parser.is_system_message == SystemMessage::ChatProtectionDisabled {
|
|
||||||
chat_id
|
|
||||||
.inner_set_protection(context, ProtectionStatus::Unprotected)
|
|
||||||
.await?;
|
|
||||||
set_better_msg(
|
|
||||||
mime_parser,
|
|
||||||
context
|
|
||||||
.stock_protection_msg(ProtectionStatus::Unprotected, from_id)
|
|
||||||
.await,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user