If remote user blocked a user, make user unable to follow

This commit is contained in:
Niko 2022-02-16 14:36:04 +01:00
parent 629de2d8b7
commit 8adfdac253
1 changed files with 8 additions and 0 deletions

View File

@ -31,6 +31,14 @@ module.exports = {
if (!utils.isURLValid(req.query.url))
return res.json({ error: 'invalid_url' })
const block = await db.table.objects().findOne({
object: apID(res.locals.user.username),
actor: req.query.url,
type: 'Block',
})
if (block !== null)
return res.json({ error: 'user_blocked_you' })
if (await getRejectedTimes(req, res) >= REJECT_TIMES_MAX)
return res.json({ error: 'follow_rejected_max' })