Do not support subscriptions to accounts
This commit is contained in:
parent
bd65cf02ff
commit
2c0ccd4b3f
|
@ -112,6 +112,7 @@ function addUserSubscription (req: express.Request, res: express.Response) {
|
||||||
const payload = {
|
const payload = {
|
||||||
name,
|
name,
|
||||||
host,
|
host,
|
||||||
|
assertIsChannel: true,
|
||||||
followerActorId: user.Account.Actor.id
|
followerActorId: user.Account.Actor.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ export type ActivitypubFollowPayload = {
|
||||||
name: string
|
name: string
|
||||||
host: string
|
host: string
|
||||||
isAutoFollow?: boolean
|
isAutoFollow?: boolean
|
||||||
|
assertIsChannel?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
async function processActivityPubFollow (job: Bull.Job) {
|
async function processActivityPubFollow (job: Bull.Job) {
|
||||||
|
@ -34,6 +35,11 @@ async function processActivityPubFollow (job: Bull.Job) {
|
||||||
targetActor = await getOrCreateActorAndServerAndModel(actorUrl, 'all')
|
targetActor = await getOrCreateActorAndServerAndModel(actorUrl, 'all')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (payload.assertIsChannel && !targetActor.VideoChannel) {
|
||||||
|
logger.warn('Do not follow %s@%s because it is not a channel.', name, host)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const fromActor = await ActorModel.load(payload.followerActorId)
|
const fromActor = await ActorModel.load(payload.followerActorId)
|
||||||
|
|
||||||
return retryTransactionWrapper(follow, fromActor, targetActor, payload.isAutoFollow)
|
return retryTransactionWrapper(follow, fromActor, targetActor, payload.isAutoFollow)
|
||||||
|
|
|
@ -53,7 +53,6 @@ const userSubscriptionGetValidator = [
|
||||||
.json({
|
.json({
|
||||||
error: `Subscription ${req.params.uri} not found.`
|
error: `Subscription ${req.params.uri} not found.`
|
||||||
})
|
})
|
||||||
.end()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
res.locals.subscription = subscription
|
res.locals.subscription = subscription
|
||||||
|
|
Loading…
Reference in New Issue