mirror of
https://github.com/Nutomic/ibis.git
synced 2024-12-26 01:11:24 +00:00
clippy
This commit is contained in:
parent
75f2530689
commit
201bba2d4b
4 changed files with 9 additions and 9 deletions
12
src/api.rs
12
src/api.rs
|
@ -94,7 +94,7 @@ async fn edit_article(
|
|||
// resolve conflict if any
|
||||
if let Some(resolve_conflict_id) = &edit_form.resolve_conflict_id {
|
||||
let mut lock = data.conflicts.lock().unwrap();
|
||||
if lock.iter().find(|c| &c.id == resolve_conflict_id).is_none() {
|
||||
if !lock.iter().any(|c| &c.id == resolve_conflict_id) {
|
||||
return Err(anyhow!("invalid resolve conflict"))?;
|
||||
}
|
||||
lock.retain(|c| &c.id != resolve_conflict_id);
|
||||
|
@ -132,7 +132,7 @@ async fn edit_article(
|
|||
};
|
||||
let mut lock = data.conflicts.lock().unwrap();
|
||||
lock.push(conflict.clone());
|
||||
return Ok(Json(Some(conflict)));
|
||||
Ok(Json(Some(conflict)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ async fn submit_article_update(
|
|||
edit_form: &EditArticleData,
|
||||
original_article: &DbArticle,
|
||||
) -> Result<(), Error> {
|
||||
let edit = DbEdit::new(&original_article, &edit_form.new_text)?;
|
||||
let edit = DbEdit::new(original_article, &edit_form.new_text)?;
|
||||
if original_article.local {
|
||||
let updated_article = {
|
||||
let mut lock = data.articles.lock().unwrap();
|
||||
|
@ -153,12 +153,12 @@ async fn submit_article_update(
|
|||
article.clone()
|
||||
};
|
||||
|
||||
UpdateLocalArticle::send(updated_article, &data).await?;
|
||||
UpdateLocalArticle::send(updated_article, data).await?;
|
||||
} else {
|
||||
UpdateRemoteArticle::send(
|
||||
edit,
|
||||
original_article.instance.dereference(&data).await?,
|
||||
&data,
|
||||
original_article.instance.dereference(data).await?,
|
||||
data,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::api::Conflict;
|
||||
use crate::federation::objects::article::DbArticle;
|
||||
use crate::federation::objects::edit::ApubEdit;
|
||||
|
||||
use crate::federation::objects::instance::DbInstance;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
|
|
@ -65,7 +65,7 @@ impl ActivityHandler for RejectEdit {
|
|||
|
||||
async fn receive(self, data: &Data<Self::DataType>) -> Result<(), Self::Error> {
|
||||
// cant convert this to DbEdit as it tries to apply patch and fails
|
||||
let mut lock = data.conflicts.lock().unwrap();
|
||||
let lock = data.conflicts.lock().unwrap();
|
||||
todo!();
|
||||
//lock.push(self.object);
|
||||
Ok(())
|
||||
|
|
|
@ -29,7 +29,7 @@ pub fn generate_article_version(
|
|||
if let Some(version) = version {
|
||||
let exists = edits.iter().any(|e| &e.version == version);
|
||||
if !exists {
|
||||
return Err(anyhow!("Attempting to generate invalid article version"))?;
|
||||
Err(anyhow!("Attempting to generate invalid article version"))?;
|
||||
}
|
||||
}
|
||||
for e in edits {
|
||||
|
|
Loading…
Reference in a new issue