1
0
Fork 0
mirror of https://github.com/Nutomic/ibis.git synced 2024-11-22 09:41:10 +00:00
This commit is contained in:
Felix Ableitner 2024-11-11 23:05:23 +01:00
parent d720a003e2
commit 53a89a51d3
4 changed files with 3 additions and 14 deletions

View file

@ -116,12 +116,7 @@ pub(in crate::backend::api) async fn edit_article(
edit_form.new_text.push('\n'); edit_form.new_text.push('\n');
} }
dbg!(
&edit_form.previous_version_id,
&original_article.latest_version
);
if edit_form.previous_version_id == original_article.latest_version { if edit_form.previous_version_id == original_article.latest_version {
dbg!("no conflict");
// No intermediate changes, simply submit new version // No intermediate changes, simply submit new version
submit_article_update( submit_article_update(
edit_form.new_text.clone(), edit_form.new_text.clone(),

View file

@ -15,6 +15,7 @@ use {
}, },
activitypub_federation::fetch::{collection_id::CollectionId, object_id::ObjectId}, activitypub_federation::fetch::{collection_id::CollectionId, object_id::ObjectId},
diesel::{Identifiable, Queryable, Selectable}, diesel::{Identifiable, Queryable, Selectable},
diesel_derive_newtype::DieselNewType,
}; };
pub const MAIN_PAGE_NAME: &str = "Main_Page"; pub const MAIN_PAGE_NAME: &str = "Main_Page";
@ -149,10 +150,8 @@ pub struct DbLocalUser {
pub person_id: i32, pub person_id: i32,
pub admin: bool, pub admin: bool,
} }
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
#[derive( #[cfg_attr(feature = "ssr", derive(DieselNewType))]
Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize, DieselNewType,
)]
pub struct PersonId(pub i32); pub struct PersonId(pub i32);
/// Federation related data from a local or remote user. /// Federation related data from a local or remote user.

View file

@ -1,6 +1,3 @@
#[macro_use]
extern crate diesel_derive_newtype;
#[cfg(feature = "ssr")] #[cfg(feature = "ssr")]
pub mod backend; pub mod backend;
pub mod common; pub mod common;

View file

@ -358,7 +358,6 @@ async fn test_local_edit_conflict() -> MyResult<()> {
previous_version_id: create_res.latest_version.clone(), previous_version_id: create_res.latest_version.clone(),
resolve_conflict_id: None, resolve_conflict_id: None,
}; };
dbg!("first edit");
let edit_res = data.alpha.edit_article(&edit_form).await?; let edit_res = data.alpha.edit_article(&edit_form).await?;
assert_eq!(edit_res.article.text, edit_form.new_text); assert_eq!(edit_res.article.text, edit_form.new_text);
assert_eq!(2, edit_res.edits.len()); assert_eq!(2, edit_res.edits.len());
@ -371,7 +370,6 @@ async fn test_local_edit_conflict() -> MyResult<()> {
previous_version_id: create_res.latest_version, previous_version_id: create_res.latest_version,
resolve_conflict_id: None, resolve_conflict_id: None,
}; };
dbg!("second edit");
let edit_res = data let edit_res = data
.alpha .alpha
.edit_article_with_conflict(&edit_form) .edit_article_with_conflict(&edit_form)