fix: Partial messages do not change group state (#4900)

This message makes that partial messages do not change the group state.
A simple fix and a comprehensive test is added. This is a follow up to
the former #4841 which took a different approach.
This commit is contained in:
Sebastian Klähn
2023-11-06 21:01:55 +01:00
committed by GitHub
parent ce32f76265
commit 1f52b8af2f
4 changed files with 131 additions and 6 deletions

View File

@@ -1818,6 +1818,14 @@ pub async fn estimate_deletion_cnt(
pub(crate) async fn rfc724_mid_exists(
context: &Context,
rfc724_mid: &str,
) -> Result<Option<MsgId>> {
rfc724_mid_exists_and(context, rfc724_mid, "1").await
}
pub(crate) async fn rfc724_mid_exists_and(
context: &Context,
rfc724_mid: &str,
cond: &str,
) -> Result<Option<MsgId>> {
let rfc724_mid = rfc724_mid.trim_start_matches('<').trim_end_matches('>');
if rfc724_mid.is_empty() {
@@ -1828,7 +1836,7 @@ pub(crate) async fn rfc724_mid_exists(
let res = context
.sql
.query_row_optional(
"SELECT id FROM msgs WHERE rfc724_mid=?",
&("SELECT id FROM msgs WHERE rfc724_mid=? AND ".to_string() + cond),
(rfc724_mid,),
|row| {
let msg_id: MsgId = row.get(0)?;