forked from alemi/upub
fix: filter out empty targets
This commit is contained in:
parent
625b8e0e02
commit
742c769014
1 changed files with 3 additions and 1 deletions
|
@ -153,7 +153,8 @@ impl Context {
|
||||||
pub async fn address_to(&self, aid: &str, oid: Option<&str>, targets: &[String]) -> Result<(), DbErr> {
|
pub async fn address_to(&self, aid: &str, oid: Option<&str>, targets: &[String]) -> Result<(), DbErr> {
|
||||||
let addressings : Vec<model::addressing::ActiveModel> = targets
|
let addressings : Vec<model::addressing::ActiveModel> = targets
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|x| !x.ends_with("/followers"))
|
.filter(|to| !to.is_empty())
|
||||||
|
.filter(|to| !to.ends_with("/followers"))
|
||||||
.map(|to| model::addressing::ActiveModel {
|
.map(|to| model::addressing::ActiveModel {
|
||||||
id: sea_orm::ActiveValue::NotSet,
|
id: sea_orm::ActiveValue::NotSet,
|
||||||
server: Set(Context::server(to)),
|
server: Set(Context::server(to)),
|
||||||
|
@ -176,6 +177,7 @@ impl Context {
|
||||||
pub async fn deliver_to(&self, aid: &str, from: &str, targets: &[String]) -> Result<(), DbErr> {
|
pub async fn deliver_to(&self, aid: &str, from: &str, targets: &[String]) -> Result<(), DbErr> {
|
||||||
let deliveries : Vec<model::delivery::ActiveModel> = targets
|
let deliveries : Vec<model::delivery::ActiveModel> = targets
|
||||||
.iter()
|
.iter()
|
||||||
|
.filter(|to| !to.is_empty())
|
||||||
.filter(|to| Context::server(to) != self.base())
|
.filter(|to| Context::server(to) != self.base())
|
||||||
.filter(|to| to != &PUBLIC_TARGET)
|
.filter(|to| to != &PUBLIC_TARGET)
|
||||||
.map(|to| model::delivery::ActiveModel {
|
.map(|to| model::delivery::ActiveModel {
|
||||||
|
|
Loading…
Reference in a new issue