mirror of
https://github.com/versia-pub/activitypub.git
synced 2026-03-12 18:49:14 +01:00
fix duplicate insert
This commit is contained in:
parent
2401a6f42d
commit
3aec94e528
1 changed files with 9 additions and 0 deletions
|
|
@ -486,6 +486,15 @@ pub async fn receive_versia_note(
|
|||
note: Note,
|
||||
db_id: String,
|
||||
) -> anyhow::Result<entities::post::Model> {
|
||||
let post_res: Option<post::Model> = prelude::Post::find()
|
||||
.filter(entities::post::Column::Id.eq(note.id.to_string()))
|
||||
.one(DB.get().unwrap())
|
||||
.await?;
|
||||
|
||||
if let Some(post) = post_res {
|
||||
return Ok(post);
|
||||
}
|
||||
|
||||
let versia_author: entities::user::Model = db_user_from_url(note.author.clone()).await?;
|
||||
let user_res = prelude::User::find_by_id(db_id)
|
||||
.one(DB.get().unwrap())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue