mirror of https://github.com/LemmyNet/lemmy.git
Move local check into function.
parent
052860e62a
commit
469eaa2d5e
|
@ -174,6 +174,8 @@ pub(crate) async fn ban_nonlocal_user_from_local_communities(
|
||||||
expires: &Option<i64>,
|
expires: &Option<i64>,
|
||||||
context: &Data<LemmyContext>,
|
context: &Data<LemmyContext>,
|
||||||
) -> LemmyResult<()> {
|
) -> LemmyResult<()> {
|
||||||
|
// Only run this code for federated users
|
||||||
|
if !target.local {
|
||||||
let ids = Person::list_local_community_ids(&mut context.pool(), target.id).await?;
|
let ids = Person::list_local_community_ids(&mut context.pool(), target.id).await?;
|
||||||
|
|
||||||
for community_id in ids {
|
for community_id in ids {
|
||||||
|
@ -243,6 +245,7 @@ pub(crate) async fn ban_nonlocal_user_from_local_communities(
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,6 @@ pub async fn ban_from_site(
|
||||||
|
|
||||||
let person_view = PersonView::read(&mut context.pool(), person.id).await?;
|
let person_view = PersonView::read(&mut context.pool(), person.id).await?;
|
||||||
|
|
||||||
if !person.local {
|
|
||||||
ban_nonlocal_user_from_local_communities(
|
ban_nonlocal_user_from_local_communities(
|
||||||
&local_user_view,
|
&local_user_view,
|
||||||
&person,
|
&person,
|
||||||
|
@ -83,7 +82,6 @@ pub async fn ban_from_site(
|
||||||
&context,
|
&context,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
|
||||||
|
|
||||||
ActivityChannel::submit_activity(
|
ActivityChannel::submit_activity(
|
||||||
SendActivityData::BanFromSite {
|
SendActivityData::BanFromSite {
|
||||||
|
|
Loading…
Reference in New Issue