Ignore Undo(Like) if reaction is not found in database

This commit is contained in:
silverpill 2021-12-21 17:54:17 +00:00
parent 2ab33f22ee
commit 07b711fd61
2 changed files with 8 additions and 3 deletions

View file

@ -478,11 +478,16 @@ pub async fn receive_activity(
match get_reaction_by_activity_id(db_client, &object_id).await {
Ok(reaction) => {
// Undo(Like)
delete_reaction(
match delete_reaction(
db_client,
&reaction.author_id,
&reaction.post_id,
).await?;
).await {
Ok(_) => (),
// Ignore undo if reaction is not found
Err(DatabaseError::NotFound(_)) => return Ok(()),
Err(other_error) => return Err(other_error.into()),
};
LIKE
},
Err(DatabaseError::NotFound(_)) => {

View file

@ -107,7 +107,7 @@ async fn inbox(
};
receive_activity(&config, &db_pool, &activity).await
.map_err(|err| {
log::warn!("failed to process activity: {}; {}", err, activity);
log::warn!("failed to process activity ({}): {}", err, activity);
err
})?;
Ok(HttpResponse::Ok().finish())