fix: persist note_extensions on AP Update activity
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled

on_update was discarding custom fields (posterUrl, movieTitle, etc),
so remote notes from movies-diary lost posters after Update delivery.
This commit is contained in:
2026-06-04 23:28:58 +02:00
parent 90d13c883b
commit 6dbd4dafdc
7 changed files with 22 additions and 9 deletions

View File

@@ -210,11 +210,11 @@ impl ApObjectHandler for ThoughtsObjectHandler {
let obj_type = object.get("type").and_then(|v| v.as_str()).unwrap_or("");
match obj_type {
"Note" | "Article" | "Page" => {
let Some((note, _)) = ThoughtNote::try_from_ap(object) else {
let Some((note, note_extensions)) = ThoughtNote::try_from_ap(object) else {
return Ok(());
};
self.repo
.apply_note_update(ap_id.as_str(), &note.content)
.apply_note_update(ap_id.as_str(), &note.content, note_extensions)
.await
.map_err(|e| anyhow!("{e}"))
}

View File

@@ -76,7 +76,12 @@ pub trait ActivityPubRepository: Send + Sync {
async fn accept_note(&self, input: AcceptNoteInput<'_>) -> Result<ThoughtId, DomainError>;
/// Apply an Update to a previously accepted remote Note.
async fn apply_note_update(&self, ap_id: &str, new_content: &str) -> Result<(), DomainError>;
async fn apply_note_update(
&self,
ap_id: &str,
new_content: &str,
note_extensions: Option<serde_json::Value>,
) -> Result<(), DomainError>;
/// Remove a specific remote Note (Delete activity). Only touches
/// remotely-originated thoughts.