send reject follow if federateBlocks is false

This commit is contained in:
Norm 2022-11-09 14:41:04 -05:00
parent b4a83bea38
commit 9c9b5bb44c

View file

@ -11,6 +11,7 @@ import { Blockings, Users, FollowRequests, Followings, UserListJoinings, UserLis
import { perUserFollowingChart } from '@/services/chart/index.js';
import { genId } from '@/misc/gen-id.js';
import { getActiveWebhooks } from '@/misc/webhook-cache.js';
import { rejectFollow } from '../following/reject.js';
export default async function(blocker: User, blockee: User) {
await Promise.all([
@ -32,9 +33,14 @@ export default async function(blocker: User, blockee: User) {
await Blockings.insert(blocking);
if (Users.isLocalUser(blocker) && Users.isRemoteUser(blockee) && blocker.federateBlocks) {
const content = renderActivity(renderBlock(blocking));
deliver(blocker, content, blockee.inbox);
if (Users.isLocalUser(blocker) && Users.isRemoteUser(blockee)) {
if (blocker.federateBlocks) {
const content = renderActivity(renderBlock(blocking));
deliver(blocker, content, blockee.inbox);
} else {
// Send a Reject Follow activity to the user being blocked to prevent them from reading follower-only posts.
rejectFollow(blocker, blockee);
}
}
}