Skip to content

Commit 22bf3ba

Browse files
committed
Avoid sending BanFromSite activities twice on user purges
Prior to LemmyNet#5515, when a user was purged, a function was called to ensure that in addtition to the site ban, purges of remote users would result in individual community bans for each local local community being federated out, as this was an intermediate solution to address the lack of federated content removal otherwise. As proper handling of banned users was implemented in that PR, the logic for federating out community bans was changed to federate directly as a site ban. This logic already existed in the user purge function, resulting in duplication. The first instance of the ban is kept rather than the second one to ensure that federation happens even if any of the later local DB writes run into issues, as those will be more likely to be caught by the admin performing the purge, so they can just repeat the request to resolve that.
1 parent 80a5406 commit 22bf3ba

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

crates/api/src/site/purge/person.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub async fn purge_person(
4040
ActivityChannel::submit_activity(
4141
SendActivityData::BanFromSite {
4242
moderator: local_user_view.person.clone(),
43-
banned_user: person.clone(),
43+
banned_user: person,
4444
reason: data.reason.clone(),
4545
remove_or_restore_data: Some(true),
4646
ban: true,
@@ -66,17 +66,5 @@ pub async fn purge_person(
6666
};
6767
AdminPurgePerson::create(&mut context.pool(), &form).await?;
6868

69-
ActivityChannel::submit_activity(
70-
SendActivityData::BanFromSite {
71-
moderator: local_user_view.person,
72-
banned_user: person,
73-
reason: data.reason.clone(),
74-
remove_or_restore_data: Some(true),
75-
ban: true,
76-
expires: None,
77-
},
78-
&context,
79-
)?;
80-
8169
Ok(Json(SuccessResponse::default()))
8270
}

0 commit comments

Comments
 (0)