Don't broadcast activities to local users

Fix #80
This commit is contained in:
Bat
2018-07-18 15:49:13 +02:00
parent 62007d17ee
commit 389ad28d14
4 changed files with 11 additions and 0 deletions
+2
View File
@@ -38,4 +38,6 @@ pub trait WithInbox {
fn get_inbox_url(&self) -> String;
fn get_shared_inbox_url(&self) -> Option<String>;
fn is_local(&self) -> bool;
}
+1
View File
@@ -84,6 +84,7 @@ impl<'a, 'r> FromRequest<'a, 'r> for ApRequest {
pub fn broadcast<A: Activity, S: sign::Signer, T: inbox::WithInbox + Actor>(sender: &S, act: A, to: Vec<T>) {
let boxes = to.into_iter()
.filter(|u| !u.is_local())
.map(|u| u.get_shared_inbox_url().unwrap_or(u.get_inbox_url()))
.collect::<Vec<String>>()
.unique();