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:
@@ -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
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user