mirror of
https://git.asonix.dog/asonix/relay.git
synced 2024-11-14 13:41:01 +00:00
Try to be a bit more clear about what object is being delivered
This commit is contained in:
parent
373072c482
commit
881654fed9
3 changed files with 21 additions and 4 deletions
|
@ -1,4 +1,7 @@
|
|||
use crate::{error::Error, jobs::JobState};
|
||||
use crate::{
|
||||
error::Error,
|
||||
jobs::{debug_object, JobState},
|
||||
};
|
||||
use activitystreams::iri_string::types::IriString;
|
||||
use background_jobs::{ActixJob, Backoff};
|
||||
use std::{future::Future, pin::Pin};
|
||||
|
@ -14,7 +17,7 @@ impl std::fmt::Debug for Deliver {
|
|||
f.debug_struct("Deliver")
|
||||
.field("to", &self.to.to_string())
|
||||
.field("activity", &self.data["type"])
|
||||
.field("object", &self.data["object"]["type"])
|
||||
.field("object", debug_object(&self.data))
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
error::Error,
|
||||
jobs::{Deliver, JobState},
|
||||
jobs::{debug_object, Deliver, JobState},
|
||||
};
|
||||
use activitystreams::iri_string::types::IriString;
|
||||
use background_jobs::ActixJob;
|
||||
|
@ -16,7 +16,7 @@ impl std::fmt::Debug for DeliverMany {
|
|||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("DeliverMany")
|
||||
.field("activity", &self.data["type"])
|
||||
.field("object", &self.data["object"]["type"])
|
||||
.field("object", debug_object(&self.data))
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,20 @@ use background_jobs::{
|
|||
};
|
||||
use std::time::Duration;
|
||||
|
||||
fn debug_object(activity: &serde_json::Value) -> &serde_json::Value {
|
||||
let mut object = &activity["object"]["type"];
|
||||
|
||||
if object.is_null() {
|
||||
object = &activity["object"]["id"];
|
||||
}
|
||||
|
||||
if object.is_null() {
|
||||
object = &activity["object"];
|
||||
}
|
||||
|
||||
object
|
||||
}
|
||||
|
||||
pub(crate) fn create_workers(
|
||||
state: State,
|
||||
actors: ActorCache,
|
||||
|
|
Loading…
Reference in a new issue