fix: persist note_extensions on AP Update activity
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:
@@ -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(), ¬e.content)
|
||||
.apply_note_update(ap_id.as_str(), ¬e.content, note_extensions)
|
||||
.await
|
||||
.map_err(|e| anyhow!("{e}"))
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user