Write activity ID to log if repost already exists in database

This commit is contained in:
silverpill 2022-12-21 19:20:28 +00:00
parent c4ad98126a
commit bf92cebe5c

View file

@ -66,13 +66,16 @@ pub async fn handle_announce(
post.id
},
};
let repost_data = PostCreateData::repost(post_id, Some(repost_object_id));
let repost_data = PostCreateData::repost(
post_id,
Some(repost_object_id.clone()),
);
match create_post(db_client, &author.id, repost_data).await {
Ok(_) => Ok(Some(NOTE)),
Err(DatabaseError::AlreadyExists("post")) => {
// Ignore activity if repost already exists (with a different
// object ID, or due to race condition in a handler).
log::warn!("repost already exists");
log::warn!("repost already exists: {}", repost_object_id);
Ok(None)
},
Err(other_error) => Err(other_error.into()),