mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 10:49:28 +02:00
Follow works
This commit is contained in:
parent
e34c85e527
commit
350e31d6b6
39 changed files with 431 additions and 169 deletions
|
@ -36,14 +36,18 @@ async function follow (account: AccountInstance, targetAccountURL: string) {
|
|||
if (targetAccount === undefined) throw new Error('Unknown account')
|
||||
if (targetAccount.isOwned() === false) throw new Error('This is not a local account.')
|
||||
|
||||
const sequelizeOptions = {
|
||||
await db.AccountFollow.findOrCreate({
|
||||
where: {
|
||||
accountId: account.id,
|
||||
targetAccountId: targetAccount.id
|
||||
},
|
||||
defaults: {
|
||||
accountId: account.id,
|
||||
targetAccountId: targetAccount.id,
|
||||
state: 'accepted'
|
||||
},
|
||||
transaction: t
|
||||
}
|
||||
await db.AccountFollow.create({
|
||||
accountId: account.id,
|
||||
targetAccountId: targetAccount.id,
|
||||
state: 'accepted'
|
||||
}, sequelizeOptions)
|
||||
})
|
||||
|
||||
// Target sends to account he accepted the follow request
|
||||
return sendAccept(targetAccount, account, t)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue