Simplify the Inbox trait

If we want to add, for instance, streams in the future, we could introduce
a new trait for that, similar to FromActivity or Notify

We also display inbox errors to the "client" if something fails,
which could be useful for debugging.
This commit is contained in:
Bat
2018-06-21 17:00:37 +01:00
parent 5193ad6f65
commit 3fe2625e86
6 changed files with 19 additions and 25 deletions
+1 -8
View File
@@ -1,6 +1,5 @@
use chrono::NaiveDateTime;
use diesel::{self, QueryDsl, RunQueryDsl, ExpressionMethods, PgConnection};
use serde_json;
use std::iter::Iterator;
use activity_pub::inbox::Inbox;
@@ -61,10 +60,4 @@ impl Instance {
}
}
impl Inbox for Instance {
fn received(&self, conn: &PgConnection, act: serde_json::Value) {
self.save(conn, act.clone()).expect("Shared Inbox: Couldn't save activity");
// TODO: add to stream, or whatever needs to be done
}
}
impl Inbox for Instance {}
+1 -9
View File
@@ -441,15 +441,7 @@ impl WithInbox for User {
}
}
impl Inbox for User {
fn received(&self, conn: &PgConnection, act: serde_json::Value) {
if let Err(err) = self.save(conn, act.clone()) {
println!("Inbox error:\n{}\n{}\n\nActivity was: {}", err.cause(), err.backtrace(), act.to_string());
}
// TODO: add to stream, or whatever needs to be done
}
}
impl Inbox for User {}
impl Signer for User {
fn get_key_id(&self) -> String {