parent
62007d17ee
commit
389ad28d14
|
@ -38,4 +38,6 @@ pub trait WithInbox {
|
||||||
fn get_inbox_url(&self) -> String;
|
fn get_inbox_url(&self) -> String;
|
||||||
|
|
||||||
fn get_shared_inbox_url(&self) -> Option<String>;
|
fn get_shared_inbox_url(&self) -> Option<String>;
|
||||||
|
|
||||||
|
fn is_local(&self) -> bool;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>) {
|
pub fn broadcast<A: Activity, S: sign::Signer, T: inbox::WithInbox + Actor>(sender: &S, act: A, to: Vec<T>) {
|
||||||
let boxes = to.into_iter()
|
let boxes = to.into_iter()
|
||||||
|
.filter(|u| !u.is_local())
|
||||||
.map(|u| u.get_shared_inbox_url().unwrap_or(u.get_inbox_url()))
|
.map(|u| u.get_shared_inbox_url().unwrap_or(u.get_inbox_url()))
|
||||||
.collect::<Vec<String>>()
|
.collect::<Vec<String>>()
|
||||||
.unique();
|
.unique();
|
||||||
|
|
|
@ -257,6 +257,10 @@ impl WithInbox for Blog {
|
||||||
fn get_shared_inbox_url(&self) -> Option<String> {
|
fn get_shared_inbox_url(&self) -> Option<String> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_local(&self) -> bool {
|
||||||
|
self.instance_id == 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl sign::Signer for Blog {
|
impl sign::Signer for Blog {
|
||||||
|
|
|
@ -421,6 +421,10 @@ impl WithInbox for User {
|
||||||
fn get_shared_inbox_url(&self) -> Option<String> {
|
fn get_shared_inbox_url(&self) -> Option<String> {
|
||||||
self.shared_inbox_url.clone()
|
self.shared_inbox_url.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_local(&self) -> bool {
|
||||||
|
self.instance_id == 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Signer for User {
|
impl Signer for User {
|
||||||
|
|
Loading…
Reference in New Issue