mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-04-02 09:33:12 +00:00
chore: fix conversation type not used
This commit is contained in:
parent
66c2abe6de
commit
d580c0ac75
@ -175,6 +175,13 @@ impl Context {
|
|||||||
.load_conversation(convo_id)?
|
.load_conversation(convo_id)?
|
||||||
.ok_or_else(|| ChatError::NoConvo(convo_id.into()))?;
|
.ok_or_else(|| ChatError::NoConvo(convo_id.into()))?;
|
||||||
|
|
||||||
|
if record.convo_type != "private_v1" {
|
||||||
|
return Err(ChatError::BadBundleValue(format!(
|
||||||
|
"unsupported conversation type: {}",
|
||||||
|
record.convo_type
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
let dr_state: RatchetState = self.ratchet_storage.load(&record.local_convo_id)?;
|
let dr_state: RatchetState = self.ratchet_storage.load(&record.local_convo_id)?;
|
||||||
|
|
||||||
Ok(PrivateV1Convo::from_stored(
|
Ok(PrivateV1Convo::from_stored(
|
||||||
|
|||||||
@ -22,6 +22,8 @@ pub enum ChatError {
|
|||||||
BadParsing(&'static str),
|
BadParsing(&'static str),
|
||||||
#[error("convo with id: {0} was not found")]
|
#[error("convo with id: {0} was not found")]
|
||||||
NoConvo(String),
|
NoConvo(String),
|
||||||
|
#[error("unsupported conversation type: {0}")]
|
||||||
|
UnsupportedConvoType(String),
|
||||||
#[error("storage error: {0}")]
|
#[error("storage error: {0}")]
|
||||||
Storage(#[from] StorageError),
|
Storage(#[from] StorageError),
|
||||||
}
|
}
|
||||||
|
|||||||
@ -223,15 +223,6 @@ impl ChatStorage {
|
|||||||
|
|
||||||
Ok(records)
|
Ok(records)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Removes a conversation by its local ID.
|
|
||||||
pub fn remove_conversation(&mut self, local_convo_id: &str) -> Result<(), StorageError> {
|
|
||||||
self.db.connection().execute(
|
|
||||||
"DELETE FROM conversations WHERE local_convo_id = ?1",
|
|
||||||
params![local_convo_id],
|
|
||||||
)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user