Show image immediately after submitting review

This commit is contained in:
Reimar 2024-09-13 12:06:45 +02:00
parent eca2b6324b
commit 0ab5fee8b2
Signed by: Reimar
GPG Key ID: 93549FA07F0AE268

View File

@ -219,7 +219,9 @@ async fn create_review(auth: AuthorizedUser, data: web::Data<AppData>, input: we
content: input.content.clone(),
rating: input.rating.clone(),
image_id: input.image_id,
image: None,
image: input.image_id.and_then(|image_id| {
db.query_row("SELECT * FROM images WHERE id = :id LIMIT 1", &[(":id", &image_id.to_string())], |row| Image::from_row(row)).ok()
}),
}),
Err(_) => HttpResponse::InternalServerError().finish(),
}