mirror of
https://github.com/chatmail/core.git
synced 2026-04-22 07:56:29 +03:00
first pass at resolving CR
This commit is contained in:
38
src/chat.rs
38
src/chat.rs
@@ -635,44 +635,6 @@ impl Chat {
|
||||
&self.name
|
||||
}
|
||||
|
||||
fn parent_query(fields: &str) -> String {
|
||||
// Check for server_uid guarantees that we don't
|
||||
// select a draft or undelivered message.
|
||||
format!(
|
||||
"SELECT {} \
|
||||
FROM msgs WHERE chat_id=?1 AND server_uid!=0 \
|
||||
ORDER BY timestamp DESC, id DESC \
|
||||
LIMIT 1;",
|
||||
fields
|
||||
)
|
||||
}
|
||||
|
||||
async fn get_parent_mime_headers(&self, context: &Context) -> Option<(String, String, String)> {
|
||||
let collect = |row: &rusqlite::Row| Ok((row.get(0)?, row.get(1)?, row.get(2)?));
|
||||
let params = paramsv![self.id];
|
||||
let sql = &context.sql;
|
||||
|
||||
let query = Self::parent_query("rfc724_mid, mime_in_reply_to, mime_references");
|
||||
|
||||
sql.query_row(&query, params, collect).await.ok()
|
||||
}
|
||||
|
||||
async fn parent_is_encrypted(&self, context: &Context) -> Result<bool, Error> {
|
||||
let sql = &context.sql;
|
||||
let params = paramsv![self.id];
|
||||
let query = Self::parent_query("param");
|
||||
|
||||
let packed: Option<String> = sql.query_get_value_result(&query, params).await?;
|
||||
|
||||
if let Some(ref packed) = packed {
|
||||
let param = packed.parse::<Params>()?;
|
||||
Ok(param.exists(Param::GuaranteeE2ee))
|
||||
} else {
|
||||
// No messages
|
||||
Ok(false)
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_profile_image(&self, context: &Context) -> Option<PathBuf> {
|
||||
if let Some(image_rel) = self.param.get(Param::ProfileImage) {
|
||||
if !image_rel.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user