From eef0a5c7e83636d5d0579d3f0a41b5a22fc18b06 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 2 Oct 2020 09:21:14 -0500 Subject: [PATCH] Adding pretty print for activities. --- lemmy_apub/src/lib.rs | 5 +++-- lemmy_db/src/activity.rs | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lemmy_apub/src/lib.rs b/lemmy_apub/src/lib.rs index 1f6e75e4..555bdccc 100644 --- a/lemmy_apub/src/lib.rs +++ b/lemmy_apub/src/lib.rs @@ -102,8 +102,9 @@ fn check_is_apub_id_valid(apub_id: &Url) -> Result<(), LemmyError> { let mut allowed_instances = Settings::get().get_allowed_instances(); let blocked_instances = Settings::get().get_blocked_instances(); - - if !allowed_instances.is_empty() { + if allowed_instances.is_empty() && blocked_instances.is_empty() { + Ok(()) + } else if !allowed_instances.is_empty() { // need to allow this explicitly because apub activities might contain objects from our local // instance. split is needed to remove the port in our federation test setup. allowed_instances.push(local_instance); diff --git a/lemmy_db/src/activity.rs b/lemmy_db/src/activity.rs index c3f0ab67..af2a1ec8 100644 --- a/lemmy_db/src/activity.rs +++ b/lemmy_db/src/activity.rs @@ -62,7 +62,11 @@ pub fn do_insert_activity( where T: Serialize + Debug, { - debug!("inserting activity for user {}, data {:?}", user_id, &data); + debug!( + "inserting activity for user {}, data {:?}", + user_id, + serde_json::to_string_pretty(&data).unwrap() + ); let activity_form = ActivityForm { user_id, data: serde_json::to_value(&data)?, -- 2.44.1