mirror of
https://git.asonix.dog/asonix/relay.git
synced 2024-11-25 02:51:12 +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 activitystreams::iri_string::types::IriString;
|
||||||
use background_jobs::{ActixJob, Backoff};
|
use background_jobs::{ActixJob, Backoff};
|
||||||
use std::{future::Future, pin::Pin};
|
use std::{future::Future, pin::Pin};
|
||||||
|
@ -14,7 +17,7 @@ impl std::fmt::Debug for Deliver {
|
||||||
f.debug_struct("Deliver")
|
f.debug_struct("Deliver")
|
||||||
.field("to", &self.to.to_string())
|
.field("to", &self.to.to_string())
|
||||||
.field("activity", &self.data["type"])
|
.field("activity", &self.data["type"])
|
||||||
.field("object", &self.data["object"]["type"])
|
.field("object", debug_object(&self.data))
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
error::Error,
|
error::Error,
|
||||||
jobs::{Deliver, JobState},
|
jobs::{debug_object, Deliver, JobState},
|
||||||
};
|
};
|
||||||
use activitystreams::iri_string::types::IriString;
|
use activitystreams::iri_string::types::IriString;
|
||||||
use background_jobs::ActixJob;
|
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 {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
f.debug_struct("DeliverMany")
|
f.debug_struct("DeliverMany")
|
||||||
.field("activity", &self.data["type"])
|
.field("activity", &self.data["type"])
|
||||||
.field("object", &self.data["object"]["type"])
|
.field("object", debug_object(&self.data))
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,20 @@ use background_jobs::{
|
||||||
};
|
};
|
||||||
use std::time::Duration;
|
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(
|
pub(crate) fn create_workers(
|
||||||
state: State,
|
state: State,
|
||||||
actors: ActorCache,
|
actors: ActorCache,
|
||||||
|
|
Loading…
Reference in a new issue