fix: update poster_url on remote review Update activity
All checks were successful
CI / Check / Test (push) Successful in 21m35s

on_update was ignoring posterUrl from the AP note, so remote instances
never got the poster even after receiving the Update.
This commit is contained in:
2026-06-04 23:21:19 +02:00
parent 886f26c7dc
commit 4dacbbfded
4 changed files with 26 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ pub trait RemoteReviewRepository: Send + Sync {
rating: u8,
comment: Option<&str>,
watched_at: NaiveDateTime,
poster_url: Option<&str>,
) -> Result<()>;
async fn delete_by_actor(&self, actor_url: &str) -> Result<()>;

View File

@@ -153,6 +153,7 @@ impl ApObjectHandler for ReviewObjectHandler {
obj.rating.min(5),
obj.comment.as_deref(),
obj.watched_at.naive_utc(),
obj.poster_url.as_deref(),
)
.await?;

View File

@@ -685,6 +685,7 @@ impl RemoteReviewRepository for PostgresFederationRepository {
rating: u8,
comment: Option<&str>,
watched_at: chrono::NaiveDateTime,
poster_url: Option<&str>,
) -> Result<()> {
let watched_at_str = datetime_to_str(&watched_at);
sqlx::query(
@@ -698,6 +699,17 @@ impl RemoteReviewRepository for PostgresFederationRepository {
.bind(actor_url)
.execute(&self.pool)
.await?;
if let Some(url) = poster_url {
sqlx::query(
"UPDATE movies SET poster_path = $1
WHERE id = (SELECT movie_id FROM reviews WHERE ap_id = $2 AND remote_actor_url = $3)",
)
.bind(url)
.bind(ap_id)
.bind(actor_url)
.execute(&self.pool)
.await?;
}
Ok(())
}

View File

@@ -870,6 +870,7 @@ impl RemoteReviewRepository for SqliteFederationRepository {
rating: u8,
comment: Option<&str>,
watched_at: chrono::NaiveDateTime,
poster_url: Option<&str>,
) -> Result<()> {
let watched_at_str = datetime_to_str(&watched_at);
sqlx::query(
@@ -883,6 +884,17 @@ impl RemoteReviewRepository for SqliteFederationRepository {
.bind(actor_url)
.execute(&self.pool)
.await?;
if let Some(url) = poster_url {
sqlx::query(
"UPDATE movies SET poster_path = ?
WHERE id = (SELECT movie_id FROM reviews WHERE ap_id = ? AND remote_actor_url = ?)",
)
.bind(url)
.bind(ap_id)
.bind(actor_url)
.execute(&self.pool)
.await?;
}
Ok(())
}